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

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

Optimal result

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

13/2*a^4*x+4*a^4*arctanh(sin(d*x+c))/d+4*a^4*sin(d*x+c)/d+1/2*a^4*cos(d*x+ 
c)*sin(d*x+c)/d+a^4*tan(d*x+c)/d
 

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(241\) vs. \(2(73)=146\).

Time = 3.41 (sec) , antiderivative size = 241, normalized size of antiderivative = 3.30 \[ \int \cos ^2(c+d x) (a+a \sec (c+d x))^4 \, dx=\frac {1}{64} a^4 (1+\cos (c+d x))^4 \sec ^8\left (\frac {1}{2} (c+d x)\right ) \left (26 x-\frac {16 \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )}{d}+\frac {16 \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )}{d}+\frac {16 \cos (d x) \sin (c)}{d}+\frac {\cos (2 d x) \sin (2 c)}{d}+\frac {16 \cos (c) \sin (d x)}{d}+\frac {\cos (2 c) \sin (2 d x)}{d}+\frac {4 \sin \left (\frac {d x}{2}\right )}{d \left (\cos \left (\frac {c}{2}\right )-\sin \left (\frac {c}{2}\right )\right ) \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )}+\frac {4 \sin \left (\frac {d x}{2}\right )}{d \left (\cos \left (\frac {c}{2}\right )+\sin \left (\frac {c}{2}\right )\right ) \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )}\right ) \] Input:

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

Output:

(a^4*(1 + Cos[c + d*x])^4*Sec[(c + d*x)/2]^8*(26*x - (16*Log[Cos[(c + d*x) 
/2] - Sin[(c + d*x)/2]])/d + (16*Log[Cos[(c + d*x)/2] + Sin[(c + d*x)/2]]) 
/d + (16*Cos[d*x]*Sin[c])/d + (Cos[2*d*x]*Sin[2*c])/d + (16*Cos[c]*Sin[d*x 
])/d + (Cos[2*c]*Sin[2*d*x])/d + (4*Sin[(d*x)/2])/(d*(Cos[c/2] - Sin[c/2]) 
*(Cos[(c + d*x)/2] - Sin[(c + d*x)/2])) + (4*Sin[(d*x)/2])/(d*(Cos[c/2] + 
Sin[c/2])*(Cos[(c + d*x)/2] + Sin[(c + d*x)/2]))))/64
 

Rubi [A] (verified)

Time = 0.30 (sec) , antiderivative size = 73, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3042, 4278, 2009}

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 \sec (c+d x)+a)^4 \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4278

\(\displaystyle \int \left (a^4 \cos ^2(c+d x)+4 a^4 \cos (c+d x)+a^4 \sec ^2(c+d x)+4 a^4 \sec (c+d x)+6 a^4\right )dx\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {4 a^4 \text {arctanh}(\sin (c+d x))}{d}+\frac {4 a^4 \sin (c+d x)}{d}+\frac {a^4 \tan (c+d x)}{d}+\frac {a^4 \sin (c+d x) \cos (c+d x)}{2 d}+\frac {13 a^4 x}{2}\)

Input:

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

Output:

(13*a^4*x)/2 + (4*a^4*ArcTanh[Sin[c + d*x]])/d + (4*a^4*Sin[c + d*x])/d + 
(a^4*Cos[c + d*x]*Sin[c + d*x])/(2*d) + (a^4*Tan[c + d*x])/d
 

Defintions of rubi rules used

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

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

rule 4278
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + 
(a_))^(m_), x_Symbol] :> Int[ExpandTrig[(a + b*csc[e + f*x])^m*(d*csc[e + f 
*x])^n, x], x] /; FreeQ[{a, b, d, e, f, m, n}, x] && EqQ[a^2 - b^2, 0] && I 
GtQ[m, 0] && RationalQ[n]
 
Maple [A] (verified)

Time = 0.82 (sec) , antiderivative size = 82, normalized size of antiderivative = 1.12

method result size
derivativedivides \(\frac {a^{4} \tan \left (d x +c \right )+4 a^{4} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+6 a^{4} \left (d x +c \right )+4 a^{4} \sin \left (d x +c \right )+a^{4} \left (\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) \(82\)
default \(\frac {a^{4} \tan \left (d x +c \right )+4 a^{4} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+6 a^{4} \left (d x +c \right )+4 a^{4} \sin \left (d x +c \right )+a^{4} \left (\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) \(82\)
parallelrisch \(-\frac {\left (-16 \sin \left (2 d x +2 c \right )-9 \sin \left (d x +c \right )-\sin \left (3 d x +3 c \right )-52 d x \cos \left (d x +c \right )+32 \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) \cos \left (d x +c \right )-32 \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) \cos \left (d x +c \right )\right ) a^{4}}{8 \cos \left (d x +c \right ) d}\) \(98\)
risch \(\frac {13 a^{4} x}{2}-\frac {i a^{4} {\mathrm e}^{2 i \left (d x +c \right )}}{8 d}-\frac {2 i a^{4} {\mathrm e}^{i \left (d x +c \right )}}{d}+\frac {2 i a^{4} {\mathrm e}^{-i \left (d x +c \right )}}{d}+\frac {i a^{4} {\mathrm e}^{-2 i \left (d x +c \right )}}{8 d}+\frac {2 i a^{4}}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}+\frac {4 a^{4} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{d}-\frac {4 a^{4} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{d}\) \(144\)
norman \(\frac {-\frac {13 a^{4} x}{2}-\frac {11 a^{4} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {20 a^{4} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{d}-\frac {2 a^{4} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{d}-\frac {12 a^{4} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{7}}{d}+\frac {5 a^{4} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{9}}{d}+\frac {13 a^{4} x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}{2}+13 a^{4} x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}-13 a^{4} x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6}-\frac {13 a^{4} x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{8}}{2}+\frac {13 a^{4} x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{10}}{2}}{\left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )^{2} \left (-1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )^{3}}-\frac {4 a^{4} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}+\frac {4 a^{4} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}\) \(258\)

Input:

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

Output:

1/d*(a^4*tan(d*x+c)+4*a^4*ln(sec(d*x+c)+tan(d*x+c))+6*a^4*(d*x+c)+4*a^4*si 
n(d*x+c)+a^4*(1/2*sin(d*x+c)*cos(d*x+c)+1/2*d*x+1/2*c))
 

Fricas [A] (verification not implemented)

Time = 0.10 (sec) , antiderivative size = 105, normalized size of antiderivative = 1.44 \[ \int \cos ^2(c+d x) (a+a \sec (c+d x))^4 \, dx=\frac {13 \, a^{4} d x \cos \left (d x + c\right ) + 4 \, a^{4} \cos \left (d x + c\right ) \log \left (\sin \left (d x + c\right ) + 1\right ) - 4 \, a^{4} \cos \left (d x + c\right ) \log \left (-\sin \left (d x + c\right ) + 1\right ) + {\left (a^{4} \cos \left (d x + c\right )^{2} + 8 \, a^{4} \cos \left (d x + c\right ) + 2 \, a^{4}\right )} \sin \left (d x + c\right )}{2 \, d \cos \left (d x + c\right )} \] Input:

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

Output:

1/2*(13*a^4*d*x*cos(d*x + c) + 4*a^4*cos(d*x + c)*log(sin(d*x + c) + 1) - 
4*a^4*cos(d*x + c)*log(-sin(d*x + c) + 1) + (a^4*cos(d*x + c)^2 + 8*a^4*co 
s(d*x + c) + 2*a^4)*sin(d*x + c))/(d*cos(d*x + c))
 

Sympy [F]

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

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

Output:

a**4*(Integral(4*cos(c + d*x)**2*sec(c + d*x), x) + Integral(6*cos(c + d*x 
)**2*sec(c + d*x)**2, x) + Integral(4*cos(c + d*x)**2*sec(c + d*x)**3, x) 
+ Integral(cos(c + d*x)**2*sec(c + d*x)**4, x) + Integral(cos(c + d*x)**2, 
 x))
 

Maxima [A] (verification not implemented)

Time = 0.03 (sec) , antiderivative size = 85, normalized size of antiderivative = 1.16 \[ \int \cos ^2(c+d x) (a+a \sec (c+d x))^4 \, dx=\frac {{\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} a^{4} + 24 \, {\left (d x + c\right )} a^{4} + 8 \, a^{4} {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 16 \, a^{4} \sin \left (d x + c\right ) + 4 \, a^{4} \tan \left (d x + c\right )}{4 \, d} \] Input:

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

Output:

1/4*((2*d*x + 2*c + sin(2*d*x + 2*c))*a^4 + 24*(d*x + c)*a^4 + 8*a^4*(log( 
sin(d*x + c) + 1) - log(sin(d*x + c) - 1)) + 16*a^4*sin(d*x + c) + 4*a^4*t 
an(d*x + c))/d
 

Giac [A] (verification not implemented)

Time = 0.20 (sec) , antiderivative size = 129, normalized size of antiderivative = 1.77 \[ \int \cos ^2(c+d x) (a+a \sec (c+d x))^4 \, dx=\frac {13 \, {\left (d x + c\right )} a^{4} + 8 \, a^{4} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 8 \, a^{4} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - \frac {4 \, a^{4} \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} + \frac {2 \, {\left (7 \, a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 9 \, a^{4} \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+a*sec(d*x+c))^4,x, algorithm="giac")
 

Output:

1/2*(13*(d*x + c)*a^4 + 8*a^4*log(abs(tan(1/2*d*x + 1/2*c) + 1)) - 8*a^4*l 
og(abs(tan(1/2*d*x + 1/2*c) - 1)) - 4*a^4*tan(1/2*d*x + 1/2*c)/(tan(1/2*d* 
x + 1/2*c)^2 - 1) + 2*(7*a^4*tan(1/2*d*x + 1/2*c)^3 + 9*a^4*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 = 10.11 (sec) , antiderivative size = 117, normalized size of antiderivative = 1.60 \[ \int \cos ^2(c+d x) (a+a \sec (c+d x))^4 \, dx=\frac {13\,a^4\,x}{2}+\frac {8\,a^4\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d}+\frac {-5\,a^4\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+2\,a^4\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+11\,a^4\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left (-{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6-{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4+{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )} \] Input:

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

Output:

(13*a^4*x)/2 + (8*a^4*atanh(tan(c/2 + (d*x)/2)))/d + (2*a^4*tan(c/2 + (d*x 
)/2)^3 - 5*a^4*tan(c/2 + (d*x)/2)^5 + 11*a^4*tan(c/2 + (d*x)/2))/(d*(tan(c 
/2 + (d*x)/2)^2 - tan(c/2 + (d*x)/2)^4 - tan(c/2 + (d*x)/2)^6 + 1))
 

Reduce [B] (verification not implemented)

Time = 0.18 (sec) , antiderivative size = 108, normalized size of antiderivative = 1.48 \[ \int \cos ^2(c+d x) (a+a \sec (c+d x))^4 \, dx=\frac {a^{4} \left (-8 \cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+8 \cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )+8 \cos \left (d x +c \right ) \sin \left (d x +c \right )+13 \cos \left (d x +c \right ) c +13 \cos \left (d x +c \right ) d x -\sin \left (d x +c \right )^{3}+3 \sin \left (d x +c \right )\right )}{2 \cos \left (d x +c \right ) d} \] Input:

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

Output:

(a**4*( - 8*cos(c + d*x)*log(tan((c + d*x)/2) - 1) + 8*cos(c + d*x)*log(ta 
n((c + d*x)/2) + 1) + 8*cos(c + d*x)*sin(c + d*x) + 13*cos(c + d*x)*c + 13 
*cos(c + d*x)*d*x - sin(c + d*x)**3 + 3*sin(c + d*x)))/(2*cos(c + d*x)*d)