\(\int \cos (c+d x) (a+b \sec (c+d x)) (A+B \sec (c+d x)+C \sec ^2(c+d x)) \, dx\) [865]

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [A] (verified)
Fricas [A] (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 = 37, antiderivative size = 52 \[ \int \cos (c+d x) (a+b \sec (c+d x)) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=(A b+a B) x+\frac {(b B+a C) \text {arctanh}(\sin (c+d x))}{d}+\frac {a A \sin (c+d x)}{d}+\frac {b C \tan (c+d x)}{d} \] Output:

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

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 71, normalized size of antiderivative = 1.37 \[ \int \cos (c+d x) (a+b \sec (c+d x)) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=A b x+a B x+\frac {b B \coth ^{-1}(\sin (c+d x))}{d}+\frac {a C \coth ^{-1}(\sin (c+d x))}{d}+\frac {a A \cos (d x) \sin (c)}{d}+\frac {a A \cos (c) \sin (d x)}{d}+\frac {b C \tan (c+d x)}{d} \] Input:

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

Output:

A*b*x + a*B*x + (b*B*ArcCoth[Sin[c + d*x]])/d + (a*C*ArcCoth[Sin[c + d*x]] 
)/d + (a*A*Cos[d*x]*Sin[c])/d + (a*A*Cos[c]*Sin[d*x])/d + (b*C*Tan[c + d*x 
])/d
 

Rubi [A] (verified)

Time = 0.52 (sec) , antiderivative size = 52, normalized size of antiderivative = 1.00, number of steps used = 9, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.243, Rules used = {3042, 4564, 3042, 4535, 24, 3042, 4533, 3042, 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 \cos (c+d x) (a+b \sec (c+d x)) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4564

\(\displaystyle \int \cos (c+d x) \left ((b B+a C) \sec ^2(c+d x)+(A b+a B) \sec (c+d x)+a A\right )dx+\frac {b C \tan (c+d x)}{d}\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4535

\(\displaystyle \int \cos (c+d x) \left ((b B+a C) \sec ^2(c+d x)+a A\right )dx+(a B+A b) \int 1dx+\frac {b C \tan (c+d x)}{d}\)

\(\Big \downarrow \) 24

\(\displaystyle \int \cos (c+d x) \left ((b B+a C) \sec ^2(c+d x)+a A\right )dx+x (a B+A b)+\frac {b C \tan (c+d x)}{d}\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4533

\(\displaystyle (a C+b B) \int \sec (c+d x)dx+x (a B+A b)+\frac {a A \sin (c+d x)}{d}+\frac {b C \tan (c+d x)}{d}\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4257

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

Input:

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

Output:

(A*b + a*B)*x + ((b*B + a*C)*ArcTanh[Sin[c + d*x]])/d + (a*A*Sin[c + d*x]) 
/d + (b*C*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 4257
Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] 
 /; FreeQ[{c, d}, x]
 

rule 4533
Int[(csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*(csc[(e_.) + (f_.)*(x_)]^2*(C_.) 
+ (A_)), x_Symbol] :> Simp[A*Cot[e + f*x]*((b*Csc[e + f*x])^m/(f*m)), x] + 
Simp[(C*m + A*(m + 1))/(b^2*m)   Int[(b*Csc[e + f*x])^(m + 2), x], x] /; Fr 
eeQ[{b, e, f, A, C}, x] && NeQ[C*m + A*(m + 1), 0] && LeQ[m, -1]
 

rule 4535
Int[(csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*((A_.) + csc[(e_.) + (f_.)*(x_)]* 
(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(C_.)), x_Symbol] :> Simp[B/b   Int[(b*Cs 
c[e + f*x])^(m + 1), x], x] + Int[(b*Csc[e + f*x])^m*(A + C*Csc[e + f*x]^2) 
, x] /; FreeQ[{b, e, f, A, B, C, m}, x]
 

rule 4564
Int[((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(C_. 
))*(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + ( 
a_)), x_Symbol] :> Simp[(-b)*C*Csc[e + f*x]*Cot[e + f*x]*((d*Csc[e + f*x])^ 
n/(f*(n + 2))), x] + Simp[1/(n + 2)   Int[(d*Csc[e + f*x])^n*Simp[A*a*(n + 
2) + (B*a*(n + 2) + b*(C*(n + 1) + A*(n + 2)))*Csc[e + f*x] + (a*C + B*b)*( 
n + 2)*Csc[e + f*x]^2, x], x], x] /; FreeQ[{a, b, d, e, f, A, B, C, n}, x] 
&&  !LtQ[n, -1]
 
Maple [A] (verified)

Time = 0.72 (sec) , antiderivative size = 74, normalized size of antiderivative = 1.42

method result size
derivativedivides \(\frac {a A \sin \left (d x +c \right )+B a \left (d x +c \right )+C a \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+A b \left (d x +c \right )+B b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+C b \tan \left (d x +c \right )}{d}\) \(74\)
default \(\frac {a A \sin \left (d x +c \right )+B a \left (d x +c \right )+C a \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+A b \left (d x +c \right )+B b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+C b \tan \left (d x +c \right )}{d}\) \(74\)
parallelrisch \(\frac {-2 \cos \left (d x +c \right ) \left (B b +C a \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+2 \cos \left (d x +c \right ) \left (B b +C a \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )+a A \sin \left (2 d x +2 c \right )+2 d x \left (A b +B a \right ) \cos \left (d x +c \right )+2 C b \sin \left (d x +c \right )}{2 \cos \left (d x +c \right ) d}\) \(108\)
risch \(A b x +a B x -\frac {i a A \,{\mathrm e}^{i \left (d x +c \right )}}{2 d}+\frac {i a A \,{\mathrm e}^{-i \left (d x +c \right )}}{2 d}+\frac {2 i C b}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B b}{d}+\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) C}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B b}{d}-\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) C}{d}\) \(143\)
norman \(\frac {\left (A b +B a \right ) x +\left (-A b -B a \right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+\left (-A b -B a \right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+\left (A b +B a \right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6}+\frac {2 \left (a A -C b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{d}+\frac {2 \left (a A +C b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}-\frac {4 a 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 )^{2}}+\frac {\left (B b +C a \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}-\frac {\left (B b +C a \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}\) \(217\)

Input:

int(cos(d*x+c)*(a+b*sec(d*x+c))*(A+B*sec(d*x+c)+C*sec(d*x+c)^2),x,method=_ 
RETURNVERBOSE)
 

Output:

1/d*(a*A*sin(d*x+c)+B*a*(d*x+c)+C*a*ln(sec(d*x+c)+tan(d*x+c))+A*b*(d*x+c)+ 
B*b*ln(sec(d*x+c)+tan(d*x+c))+C*b*tan(d*x+c))
 

Fricas [A] (verification not implemented)

Time = 0.09 (sec) , antiderivative size = 101, normalized size of antiderivative = 1.94 \[ \int \cos (c+d x) (a+b \sec (c+d x)) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {2 \, {\left (B a + A b\right )} d x \cos \left (d x + c\right ) + {\left (C a + B b\right )} \cos \left (d x + c\right ) \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left (C a + B b\right )} \cos \left (d x + c\right ) \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (A a \cos \left (d x + c\right ) + C b\right )} \sin \left (d x + c\right )}{2 \, d \cos \left (d x + c\right )} \] Input:

integrate(cos(d*x+c)*(a+b*sec(d*x+c))*(A+B*sec(d*x+c)+C*sec(d*x+c)^2),x, a 
lgorithm="fricas")
 

Output:

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

Sympy [F]

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

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

Output:

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

Maxima [A] (verification not implemented)

Time = 0.03 (sec) , antiderivative size = 92, normalized size of antiderivative = 1.77 \[ \int \cos (c+d x) (a+b \sec (c+d x)) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {2 \, {\left (d x + c\right )} B a + 2 \, {\left (d x + c\right )} A b + C a {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + B 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 a \sin \left (d x + c\right ) + 2 \, C b \tan \left (d x + c\right )}{2 \, d} \] Input:

integrate(cos(d*x+c)*(a+b*sec(d*x+c))*(A+B*sec(d*x+c)+C*sec(d*x+c)^2),x, a 
lgorithm="maxima")
 

Output:

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

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 134 vs. \(2 (52) = 104\).

Time = 0.22 (sec) , antiderivative size = 134, normalized size of antiderivative = 2.58 \[ \int \cos (c+d x) (a+b \sec (c+d x)) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {{\left (B a + A b\right )} {\left (d x + c\right )} + {\left (C a + B b\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - {\left (C a + B b\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) + \frac {2 \, {\left (A a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - C b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - A a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - C b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} - 1}}{d} \] Input:

integrate(cos(d*x+c)*(a+b*sec(d*x+c))*(A+B*sec(d*x+c)+C*sec(d*x+c)^2),x, a 
lgorithm="giac")
 

Output:

((B*a + A*b)*(d*x + c) + (C*a + B*b)*log(abs(tan(1/2*d*x + 1/2*c) + 1)) - 
(C*a + B*b)*log(abs(tan(1/2*d*x + 1/2*c) - 1)) + 2*(A*a*tan(1/2*d*x + 1/2* 
c)^3 - C*b*tan(1/2*d*x + 1/2*c)^3 - A*a*tan(1/2*d*x + 1/2*c) - C*b*tan(1/2 
*d*x + 1/2*c))/(tan(1/2*d*x + 1/2*c)^4 - 1))/d
 

Mupad [B] (verification not implemented)

Time = 13.11 (sec) , antiderivative size = 153, normalized size of antiderivative = 2.94 \[ \int \cos (c+d x) (a+b \sec (c+d x)) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {C\,b\,\mathrm {tan}\left (c+d\,x\right )}{d}+\frac {2\,A\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {2\,B\,a\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {2\,B\,b\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {2\,C\,a\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {A\,a\,\sin \left (2\,c+2\,d\,x\right )}{2\,d\,\cos \left (c+d\,x\right )} \] Input:

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

Output:

(C*b*tan(c + d*x))/d + (2*A*b*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2))) 
/d + (2*B*a*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d + (2*B*b*atanh( 
sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d + (2*C*a*atanh(sin(c/2 + (d*x)/2 
)/cos(c/2 + (d*x)/2)))/d + (A*a*sin(2*c + 2*d*x))/(2*d*cos(c + d*x))
 

Reduce [B] (verification not implemented)

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

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

Output:

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