\(\int (a+a \sec (c+d x))^2 \tan ^7(c+d x) \, dx\) [20]

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [A] (verified)
Fricas [A] (verification not implemented)
Sympy [B] (verification not implemented)
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 = 132 \[ \int (a+a \sec (c+d x))^2 \tan ^7(c+d x) \, dx=\frac {a^2 \log (\cos (c+d x))}{d}-\frac {2 a^2 \sec (c+d x)}{d}+\frac {a^2 \sec ^2(c+d x)}{d}+\frac {2 a^2 \sec ^3(c+d x)}{d}-\frac {6 a^2 \sec ^5(c+d x)}{5 d}-\frac {a^2 \sec ^6(c+d x)}{3 d}+\frac {2 a^2 \sec ^7(c+d x)}{7 d}+\frac {a^2 \sec ^8(c+d x)}{8 d} \] Output:

a^2*ln(cos(d*x+c))/d-2*a^2*sec(d*x+c)/d+a^2*sec(d*x+c)^2/d+2*a^2*sec(d*x+c 
)^3/d-6/5*a^2*sec(d*x+c)^5/d-1/3*a^2*sec(d*x+c)^6/d+2/7*a^2*sec(d*x+c)^7/d 
+1/8*a^2*sec(d*x+c)^8/d
 

Mathematica [A] (verified)

Time = 0.67 (sec) , antiderivative size = 159, normalized size of antiderivative = 1.20 \[ \int (a+a \sec (c+d x))^2 \tan ^7(c+d x) \, dx=\frac {a^2 (-6156 \cos (c+d x)+7 (-636 \cos (3 (c+d x))+20 \cos (2 (c+d x)) (29+42 \log (\cos (c+d x)))+5 (104-36 \cos (5 (c+d x))+12 \cos (6 (c+d x))-12 \cos (7 (c+d x))+105 \log (\cos (c+d x))+24 \cos (6 (c+d x)) \log (\cos (c+d x))+3 \cos (8 (c+d x)) \log (\cos (c+d x))+12 \cos (4 (c+d x)) (6+7 \log (\cos (c+d x)))))) \sec ^8(c+d x)}{13440 d} \] Input:

Integrate[(a + a*Sec[c + d*x])^2*Tan[c + d*x]^7,x]
 

Output:

(a^2*(-6156*Cos[c + d*x] + 7*(-636*Cos[3*(c + d*x)] + 20*Cos[2*(c + d*x)]* 
(29 + 42*Log[Cos[c + d*x]]) + 5*(104 - 36*Cos[5*(c + d*x)] + 12*Cos[6*(c + 
 d*x)] - 12*Cos[7*(c + d*x)] + 105*Log[Cos[c + d*x]] + 24*Cos[6*(c + d*x)] 
*Log[Cos[c + d*x]] + 3*Cos[8*(c + d*x)]*Log[Cos[c + d*x]] + 12*Cos[4*(c + 
d*x)]*(6 + 7*Log[Cos[c + d*x]]))))*Sec[c + d*x]^8)/(13440*d)
 

Rubi [A] (verified)

Time = 0.29 (sec) , antiderivative size = 94, normalized size of antiderivative = 0.71, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {3042, 25, 4367, 27, 99, 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 \tan ^7(c+d x) (a \sec (c+d x)+a)^2 \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 25

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

\(\Big \downarrow \) 4367

\(\displaystyle -\frac {\int a^8 (1-\cos (c+d x))^3 (\cos (c+d x)+1)^5 \sec ^9(c+d x)d\cos (c+d x)}{a^6 d}\)

\(\Big \downarrow \) 27

\(\displaystyle -\frac {a^2 \int (1-\cos (c+d x))^3 (\cos (c+d x)+1)^5 \sec ^9(c+d x)d\cos (c+d x)}{d}\)

\(\Big \downarrow \) 99

\(\displaystyle -\frac {a^2 \int \left (\sec ^9(c+d x)+2 \sec ^8(c+d x)-2 \sec ^7(c+d x)-6 \sec ^6(c+d x)+6 \sec ^4(c+d x)+2 \sec ^3(c+d x)-2 \sec ^2(c+d x)-\sec (c+d x)\right )d\cos (c+d x)}{d}\)

\(\Big \downarrow \) 2009

\(\displaystyle -\frac {a^2 \left (-\frac {1}{8} \sec ^8(c+d x)-\frac {2}{7} \sec ^7(c+d x)+\frac {1}{3} \sec ^6(c+d x)+\frac {6}{5} \sec ^5(c+d x)-2 \sec ^3(c+d x)-\sec ^2(c+d x)+2 \sec (c+d x)-\log (\cos (c+d x))\right )}{d}\)

Input:

Int[(a + a*Sec[c + d*x])^2*Tan[c + d*x]^7,x]
 

Output:

-((a^2*(-Log[Cos[c + d*x]] + 2*Sec[c + d*x] - Sec[c + d*x]^2 - 2*Sec[c + d 
*x]^3 + (6*Sec[c + d*x]^5)/5 + Sec[c + d*x]^6/3 - (2*Sec[c + d*x]^7)/7 - S 
ec[c + d*x]^8/8))/d)
 

Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 27
Int[(a_)*(Fx_), x_Symbol] :> Simp[a   Int[Fx, x], x] /; FreeQ[a, x] &&  !Ma 
tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
 

rule 99
Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_)*((e_.) + (f_.)*(x_) 
)^(p_), x_] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d*x)^n*(e + f*x)^p, x], 
 x] /; FreeQ[{a, b, c, d, e, f, p}, x] && IntegersQ[m, n] && (IntegerQ[p] | 
| (GtQ[m, 0] && GeQ[n, -1]))
 

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 4367
Int[cot[(c_.) + (d_.)*(x_)]^(m_.)*(csc[(c_.) + (d_.)*(x_)]*(b_.) + (a_))^(n 
_.), x_Symbol] :> Simp[1/(a^(m - n - 1)*b^n*d)   Subst[Int[(a - b*x)^((m - 
1)/2)*((a + b*x)^((m - 1)/2 + n)/x^(m + n)), x], x, Sin[c + d*x]], x] /; Fr 
eeQ[{a, b, c, d}, x] && IntegerQ[(m - 1)/2] && EqQ[a^2 - b^2, 0] && Integer 
Q[n]
 
Maple [A] (verified)

Time = 0.68 (sec) , antiderivative size = 84, normalized size of antiderivative = 0.64

method result size
derivativedivides \(\frac {a^{2} \left (\frac {\sec \left (d x +c \right )^{8}}{8}+\frac {2 \sec \left (d x +c \right )^{7}}{7}-\frac {\sec \left (d x +c \right )^{6}}{3}-\frac {6 \sec \left (d x +c \right )^{5}}{5}+2 \sec \left (d x +c \right )^{3}+\sec \left (d x +c \right )^{2}-2 \sec \left (d x +c \right )-\ln \left (\sec \left (d x +c \right )\right )\right )}{d}\) \(84\)
default \(\frac {a^{2} \left (\frac {\sec \left (d x +c \right )^{8}}{8}+\frac {2 \sec \left (d x +c \right )^{7}}{7}-\frac {\sec \left (d x +c \right )^{6}}{3}-\frac {6 \sec \left (d x +c \right )^{5}}{5}+2 \sec \left (d x +c \right )^{3}+\sec \left (d x +c \right )^{2}-2 \sec \left (d x +c \right )-\ln \left (\sec \left (d x +c \right )\right )\right )}{d}\) \(84\)
parts \(\frac {a^{2} \left (\frac {\tan \left (d x +c \right )^{6}}{6}-\frac {\tan \left (d x +c \right )^{4}}{4}+\frac {\tan \left (d x +c \right )^{2}}{2}-\frac {\ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2}\right )}{d}+\frac {a^{2} \tan \left (d x +c \right )^{8}}{8 d}+\frac {2 a^{2} \left (\frac {\sec \left (d x +c \right )^{7}}{7}-\frac {3 \sec \left (d x +c \right )^{5}}{5}+\sec \left (d x +c \right )^{3}-\sec \left (d x +c \right )\right )}{d}\) \(114\)
risch \(-i a^{2} x -\frac {2 i a^{2} c}{d}-\frac {4 a^{2} \left (105 \,{\mathrm e}^{15 i \left (d x +c \right )}-105 \,{\mathrm e}^{14 i \left (d x +c \right )}+315 \,{\mathrm e}^{13 i \left (d x +c \right )}-630 \,{\mathrm e}^{12 i \left (d x +c \right )}+1113 \,{\mathrm e}^{11 i \left (d x +c \right )}-1015 \,{\mathrm e}^{10 i \left (d x +c \right )}+1539 \,{\mathrm e}^{9 i \left (d x +c \right )}-1820 \,{\mathrm e}^{8 i \left (d x +c \right )}+1539 \,{\mathrm e}^{7 i \left (d x +c \right )}-1015 \,{\mathrm e}^{6 i \left (d x +c \right )}+1113 \,{\mathrm e}^{5 i \left (d x +c \right )}-630 \,{\mathrm e}^{4 i \left (d x +c \right )}+315 \,{\mathrm e}^{3 i \left (d x +c \right )}-105 \,{\mathrm e}^{2 i \left (d x +c \right )}+105 \,{\mathrm e}^{i \left (d x +c \right )}\right )}{105 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{8}}+\frac {a^{2} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d}\) \(225\)

Input:

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

Output:

a^2/d*(1/8*sec(d*x+c)^8+2/7*sec(d*x+c)^7-1/3*sec(d*x+c)^6-6/5*sec(d*x+c)^5 
+2*sec(d*x+c)^3+sec(d*x+c)^2-2*sec(d*x+c)-ln(sec(d*x+c)))
 

Fricas [A] (verification not implemented)

Time = 0.10 (sec) , antiderivative size = 117, normalized size of antiderivative = 0.89 \[ \int (a+a \sec (c+d x))^2 \tan ^7(c+d x) \, dx=\frac {840 \, a^{2} \cos \left (d x + c\right )^{8} \log \left (-\cos \left (d x + c\right )\right ) - 1680 \, a^{2} \cos \left (d x + c\right )^{7} + 840 \, a^{2} \cos \left (d x + c\right )^{6} + 1680 \, a^{2} \cos \left (d x + c\right )^{5} - 1008 \, a^{2} \cos \left (d x + c\right )^{3} - 280 \, a^{2} \cos \left (d x + c\right )^{2} + 240 \, a^{2} \cos \left (d x + c\right ) + 105 \, a^{2}}{840 \, d \cos \left (d x + c\right )^{8}} \] Input:

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

Output:

1/840*(840*a^2*cos(d*x + c)^8*log(-cos(d*x + c)) - 1680*a^2*cos(d*x + c)^7 
 + 840*a^2*cos(d*x + c)^6 + 1680*a^2*cos(d*x + c)^5 - 1008*a^2*cos(d*x + c 
)^3 - 280*a^2*cos(d*x + c)^2 + 240*a^2*cos(d*x + c) + 105*a^2)/(d*cos(d*x 
+ c)^8)
 

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 252 vs. \(2 (119) = 238\).

Time = 1.26 (sec) , antiderivative size = 252, normalized size of antiderivative = 1.91 \[ \int (a+a \sec (c+d x))^2 \tan ^7(c+d x) \, dx=\begin {cases} - \frac {a^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {a^{2} \tan ^{6}{\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}}{8 d} + \frac {2 a^{2} \tan ^{6}{\left (c + d x \right )} \sec {\left (c + d x \right )}}{7 d} + \frac {a^{2} \tan ^{6}{\left (c + d x \right )}}{6 d} - \frac {a^{2} \tan ^{4}{\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}}{8 d} - \frac {12 a^{2} \tan ^{4}{\left (c + d x \right )} \sec {\left (c + d x \right )}}{35 d} - \frac {a^{2} \tan ^{4}{\left (c + d x \right )}}{4 d} + \frac {a^{2} \tan ^{2}{\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}}{8 d} + \frac {16 a^{2} \tan ^{2}{\left (c + d x \right )} \sec {\left (c + d x \right )}}{35 d} + \frac {a^{2} \tan ^{2}{\left (c + d x \right )}}{2 d} - \frac {a^{2} \sec ^{2}{\left (c + d x \right )}}{8 d} - \frac {32 a^{2} \sec {\left (c + d x \right )}}{35 d} & \text {for}\: d \neq 0 \\x \left (a \sec {\left (c \right )} + a\right )^{2} \tan ^{7}{\left (c \right )} & \text {otherwise} \end {cases} \] Input:

integrate((a+a*sec(d*x+c))**2*tan(d*x+c)**7,x)
 

Output:

Piecewise((-a**2*log(tan(c + d*x)**2 + 1)/(2*d) + a**2*tan(c + d*x)**6*sec 
(c + d*x)**2/(8*d) + 2*a**2*tan(c + d*x)**6*sec(c + d*x)/(7*d) + a**2*tan( 
c + d*x)**6/(6*d) - a**2*tan(c + d*x)**4*sec(c + d*x)**2/(8*d) - 12*a**2*t 
an(c + d*x)**4*sec(c + d*x)/(35*d) - a**2*tan(c + d*x)**4/(4*d) + a**2*tan 
(c + d*x)**2*sec(c + d*x)**2/(8*d) + 16*a**2*tan(c + d*x)**2*sec(c + d*x)/ 
(35*d) + a**2*tan(c + d*x)**2/(2*d) - a**2*sec(c + d*x)**2/(8*d) - 32*a**2 
*sec(c + d*x)/(35*d), Ne(d, 0)), (x*(a*sec(c) + a)**2*tan(c)**7, True))
 

Maxima [A] (verification not implemented)

Time = 0.04 (sec) , antiderivative size = 110, normalized size of antiderivative = 0.83 \[ \int (a+a \sec (c+d x))^2 \tan ^7(c+d x) \, dx=\frac {840 \, a^{2} \log \left (\cos \left (d x + c\right )\right ) - \frac {1680 \, a^{2} \cos \left (d x + c\right )^{7} - 840 \, a^{2} \cos \left (d x + c\right )^{6} - 1680 \, a^{2} \cos \left (d x + c\right )^{5} + 1008 \, a^{2} \cos \left (d x + c\right )^{3} + 280 \, a^{2} \cos \left (d x + c\right )^{2} - 240 \, a^{2} \cos \left (d x + c\right ) - 105 \, a^{2}}{\cos \left (d x + c\right )^{8}}}{840 \, d} \] Input:

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

Output:

1/840*(840*a^2*log(cos(d*x + c)) - (1680*a^2*cos(d*x + c)^7 - 840*a^2*cos( 
d*x + c)^6 - 1680*a^2*cos(d*x + c)^5 + 1008*a^2*cos(d*x + c)^3 + 280*a^2*c 
os(d*x + c)^2 - 240*a^2*cos(d*x + c) - 105*a^2)/cos(d*x + c)^8)/d
 

Giac [A] (verification not implemented)

Time = 0.32 (sec) , antiderivative size = 111, normalized size of antiderivative = 0.84 \[ \int (a+a \sec (c+d x))^2 \tan ^7(c+d x) \, dx=\frac {840 \, a^{2} \log \left ({\left | \cos \left (d x + c\right ) \right |}\right ) - \frac {1680 \, a^{2} \cos \left (d x + c\right )^{7} - 840 \, a^{2} \cos \left (d x + c\right )^{6} - 1680 \, a^{2} \cos \left (d x + c\right )^{5} + 1008 \, a^{2} \cos \left (d x + c\right )^{3} + 280 \, a^{2} \cos \left (d x + c\right )^{2} - 240 \, a^{2} \cos \left (d x + c\right ) - 105 \, a^{2}}{\cos \left (d x + c\right )^{8}}}{840 \, d} \] Input:

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

Output:

1/840*(840*a^2*log(abs(cos(d*x + c))) - (1680*a^2*cos(d*x + c)^7 - 840*a^2 
*cos(d*x + c)^6 - 1680*a^2*cos(d*x + c)^5 + 1008*a^2*cos(d*x + c)^3 + 280* 
a^2*cos(d*x + c)^2 - 240*a^2*cos(d*x + c) - 105*a^2)/cos(d*x + c)^8)/d
 

Mupad [B] (verification not implemented)

Time = 15.50 (sec) , antiderivative size = 249, normalized size of antiderivative = 1.89 \[ \int (a+a \sec (c+d x))^2 \tan ^7(c+d x) \, dx=\frac {2\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^{14}-16\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^{12}+\frac {170\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^{10}}{3}-\frac {352\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^8}{3}+\frac {2386\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6}{15}-\frac {336\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4}{5}+\frac {582\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}{35}-\frac {64\,a^2}{35}}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^{16}-8\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^{14}+28\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^{12}-56\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^{10}+70\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^8-56\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6+28\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4-8\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )}-\frac {2\,a^2\,\mathrm {atanh}\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\right )}{d} \] Input:

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

Output:

((582*a^2*tan(c/2 + (d*x)/2)^2)/35 - (336*a^2*tan(c/2 + (d*x)/2)^4)/5 + (2 
386*a^2*tan(c/2 + (d*x)/2)^6)/15 - (352*a^2*tan(c/2 + (d*x)/2)^8)/3 + (170 
*a^2*tan(c/2 + (d*x)/2)^10)/3 - 16*a^2*tan(c/2 + (d*x)/2)^12 + 2*a^2*tan(c 
/2 + (d*x)/2)^14 - (64*a^2)/35)/(d*(28*tan(c/2 + (d*x)/2)^4 - 8*tan(c/2 + 
(d*x)/2)^2 - 56*tan(c/2 + (d*x)/2)^6 + 70*tan(c/2 + (d*x)/2)^8 - 56*tan(c/ 
2 + (d*x)/2)^10 + 28*tan(c/2 + (d*x)/2)^12 - 8*tan(c/2 + (d*x)/2)^14 + tan 
(c/2 + (d*x)/2)^16 + 1)) - (2*a^2*atanh(tan(c/2 + (d*x)/2)^2))/d
 

Reduce [B] (verification not implemented)

Time = 0.16 (sec) , antiderivative size = 172, normalized size of antiderivative = 1.30 \[ \int (a+a \sec (c+d x))^2 \tan ^7(c+d x) \, dx=\frac {a^{2} \left (-420 \,\mathrm {log}\left (\tan \left (d x +c \right )^{2}+1\right )+105 \sec \left (d x +c \right )^{2} \tan \left (d x +c \right )^{6}-105 \sec \left (d x +c \right )^{2} \tan \left (d x +c \right )^{4}+105 \sec \left (d x +c \right )^{2} \tan \left (d x +c \right )^{2}-105 \sec \left (d x +c \right )^{2}+240 \sec \left (d x +c \right ) \tan \left (d x +c \right )^{6}-288 \sec \left (d x +c \right ) \tan \left (d x +c \right )^{4}+384 \sec \left (d x +c \right ) \tan \left (d x +c \right )^{2}-768 \sec \left (d x +c \right )+140 \tan \left (d x +c \right )^{6}-210 \tan \left (d x +c \right )^{4}+420 \tan \left (d x +c \right )^{2}\right )}{840 d} \] Input:

int((a+a*sec(d*x+c))^2*tan(d*x+c)^7,x)
 

Output:

(a**2*( - 420*log(tan(c + d*x)**2 + 1) + 105*sec(c + d*x)**2*tan(c + d*x)* 
*6 - 105*sec(c + d*x)**2*tan(c + d*x)**4 + 105*sec(c + d*x)**2*tan(c + d*x 
)**2 - 105*sec(c + d*x)**2 + 240*sec(c + d*x)*tan(c + d*x)**6 - 288*sec(c 
+ d*x)*tan(c + d*x)**4 + 384*sec(c + d*x)*tan(c + d*x)**2 - 768*sec(c + d* 
x) + 140*tan(c + d*x)**6 - 210*tan(c + d*x)**4 + 420*tan(c + d*x)**2))/(84 
0*d)