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

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 = 31, antiderivative size = 58 \[ \int \cos ^2(c+d x) (a+b \sec (c+d x)) \left (A+C \sec ^2(c+d x)\right ) \, dx=\frac {1}{2} a (A+2 C) x+\frac {b C \text {arctanh}(\sin (c+d x))}{d}+\frac {A b \sin (c+d x)}{d}+\frac {a A \cos (c+d x) \sin (c+d x)}{2 d} \] Output:

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

Mathematica [A] (verified)

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

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

Output:

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

Rubi [A] (verified)

Time = 0.52 (sec) , antiderivative size = 62, normalized size of antiderivative = 1.07, number of steps used = 10, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.323, Rules used = {3042, 4563, 25, 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 ^2(c+d x) (a+b \sec (c+d x)) \left (A+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+C \csc \left (c+d x+\frac {\pi }{2}\right )^2\right )}{\csc \left (c+d x+\frac {\pi }{2}\right )^2}dx\)

\(\Big \downarrow \) 4563

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

\(\Big \downarrow \) 25

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4535

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

\(\Big \downarrow \) 24

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4533

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4257

\(\displaystyle \frac {1}{2} \left (a x (A+2 C)+\frac {2 A b \sin (c+d x)}{d}+\frac {2 b C \text {arctanh}(\sin (c+d x))}{d}\right )+\frac {a A \sin (c+d x) \cos (c+d x)}{2 d}\)

Input:

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

Output:

(a*A*Cos[c + d*x]*Sin[c + d*x])/(2*d) + (a*(A + 2*C)*x + (2*b*C*ArcTanh[Si 
n[c + d*x]])/d + (2*A*b*Sin[c + d*x])/d)/2
 

Defintions of rubi rules used

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

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], 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 4563
Int[((A_.) + csc[(e_.) + (f_.)*(x_)]^2*(C_.))*(csc[(e_.) + (f_.)*(x_)]*(d_. 
))^(n_)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> Simp[A*a*Cot[e 
 + f*x]*((d*Csc[e + f*x])^n/(f*n)), x] + Simp[1/(d*n)   Int[(d*Csc[e + f*x] 
)^(n + 1)*Simp[A*b*n + a*(C*n + A*(n + 1))*Csc[e + f*x] + b*C*n*Csc[e + f*x 
]^2, x], x], x] /; FreeQ[{a, b, d, e, f, A, C}, x] && LtQ[n, -1]
 
Maple [A] (verified)

Time = 0.36 (sec) , antiderivative size = 65, normalized size of antiderivative = 1.12

method result size
derivativedivides \(\frac {a A \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+C a \left (d x +c \right )+A b \sin \left (d x +c \right )+C b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}\) \(65\)
default \(\frac {a A \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+C a \left (d x +c \right )+A b \sin \left (d x +c \right )+C b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}\) \(65\)
parallelrisch \(\frac {-4 C \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) b +4 C \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) b +a A \sin \left (2 d x +2 c \right )+4 A b \sin \left (d x +c \right )+2 a \left (A +2 C \right ) x d}{4 d}\) \(71\)
risch \(\frac {a A x}{2}+a x C -\frac {i A b \,{\mathrm e}^{i \left (d x +c \right )}}{2 d}+\frac {i A b \,{\mathrm e}^{-i \left (d x +c \right )}}{2 d}+\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) C}{d}-\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) C}{d}+\frac {a A \sin \left (2 d x +2 c \right )}{4 d}\) \(100\)
norman \(\frac {\left (\frac {1}{2} a A +C a \right ) x +\left (\frac {1}{2} a A +C a \right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{8}+\left (-a A -2 C a \right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+\frac {A \left (a +2 b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {A \left (3 a -2 b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{d}-\frac {A \left (a -2 b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{7}}{d}-\frac {A \left (3 a +2 b \right ) \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 )^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right )^{2}}+\frac {C b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}-\frac {C b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}\) \(212\)

Input:

int(cos(d*x+c)^2*(a+b*sec(d*x+c))*(A+C*sec(d*x+c)^2),x,method=_RETURNVERBO 
SE)
 

Output:

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

Fricas [A] (verification not implemented)

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

integrate(cos(d*x+c)^2*(a+b*sec(d*x+c))*(A+C*sec(d*x+c)^2),x, algorithm="f 
ricas")
 

Output:

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

Sympy [F]

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

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

Output:

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

Maxima [A] (verification not implemented)

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

integrate(cos(d*x+c)^2*(a+b*sec(d*x+c))*(A+C*sec(d*x+c)^2),x, algorithm="m 
axima")
 

Output:

1/4*((2*d*x + 2*c + sin(2*d*x + 2*c))*A*a + 4*(d*x + c)*C*a + 2*C*b*(log(s 
in(d*x + c) + 1) - log(sin(d*x + c) - 1)) + 4*A*b*sin(d*x + c))/d
 

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 127 vs. \(2 (54) = 108\).

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

integrate(cos(d*x+c)^2*(a+b*sec(d*x+c))*(A+C*sec(d*x+c)^2),x, algorithm="g 
iac")
 

Output:

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

Mupad [B] (verification not implemented)

Time = 11.93 (sec) , antiderivative size = 115, normalized size of antiderivative = 1.98 \[ \int \cos ^2(c+d x) (a+b \sec (c+d x)) \left (A+C \sec ^2(c+d x)\right ) \, dx=\frac {A\,b\,\sin \left (c+d\,x\right )}{d}+\frac {A\,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\,C\,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\,C\,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 {A\,a\,\sin \left (2\,c+2\,d\,x\right )}{4\,d} \] Input:

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

Output:

(A*b*sin(c + d*x))/d + (A*a*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d 
 + (2*C*a*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d + (2*C*b*atanh(si 
n(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d + (A*a*sin(2*c + 2*d*x))/(4*d)
 

Reduce [B] (verification not implemented)

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

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

Output:

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