\(\int \cos ^7(c+d x) (a+b \tan (c+d x))^2 \, dx\) [534]

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 = 21, antiderivative size = 107 \[ \int \cos ^7(c+d x) (a+b \tan (c+d x))^2 \, dx=-\frac {2 a b \cos ^7(c+d x)}{7 d}+\frac {a^2 \sin (c+d x)}{d}-\frac {\left (3 a^2-b^2\right ) \sin ^3(c+d x)}{3 d}+\frac {\left (3 a^2-2 b^2\right ) \sin ^5(c+d x)}{5 d}-\frac {\left (a^2-b^2\right ) \sin ^7(c+d x)}{7 d} \] Output:

-2/7*a*b*cos(d*x+c)^7/d+a^2*sin(d*x+c)/d-1/3*(3*a^2-b^2)*sin(d*x+c)^3/d+1/ 
5*(3*a^2-2*b^2)*sin(d*x+c)^5/d-1/7*(a^2-b^2)*sin(d*x+c)^7/d
 

Mathematica [A] (verified)

Time = 0.19 (sec) , antiderivative size = 92, normalized size of antiderivative = 0.86 \[ \int \cos ^7(c+d x) (a+b \tan (c+d x))^2 \, dx=\frac {-30 a b \cos ^7(c+d x)+105 a^2 \sin (c+d x)-35 \left (3 a^2-b^2\right ) \sin ^3(c+d x)+21 \left (3 a^2-2 b^2\right ) \sin ^5(c+d x)-15 \left (a^2-b^2\right ) \sin ^7(c+d x)}{105 d} \] Input:

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

Output:

(-30*a*b*Cos[c + d*x]^7 + 105*a^2*Sin[c + d*x] - 35*(3*a^2 - b^2)*Sin[c + 
d*x]^3 + 21*(3*a^2 - 2*b^2)*Sin[c + d*x]^5 - 15*(a^2 - b^2)*Sin[c + d*x]^7 
)/(105*d)
 

Rubi [A] (verified)

Time = 0.45 (sec) , antiderivative size = 100, normalized size of antiderivative = 0.93, number of steps used = 10, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.429, Rules used = {3042, 3991, 27, 3042, 3045, 15, 4159, 290, 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 ^7(c+d x) (a+b \tan (c+d x))^2 \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {(a+b \tan (c+d x))^2}{\sec (c+d x)^7}dx\)

\(\Big \downarrow \) 3991

\(\displaystyle \int \cos ^7(c+d x) \left (a^2+b^2 \tan ^2(c+d x)\right )dx+\int 2 a b \cos ^6(c+d x) \sin (c+d x)dx\)

\(\Big \downarrow \) 27

\(\displaystyle \int \cos ^7(c+d x) \left (a^2+b^2 \tan ^2(c+d x)\right )dx+2 a b \int \cos ^6(c+d x) \sin (c+d x)dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {a^2+b^2 \tan (c+d x)^2}{\sec (c+d x)^7}dx+2 a b \int \cos (c+d x)^6 \sin (c+d x)dx\)

\(\Big \downarrow \) 3045

\(\displaystyle \int \frac {a^2+b^2 \tan (c+d x)^2}{\sec (c+d x)^7}dx-\frac {2 a b \int \cos ^6(c+d x)d\cos (c+d x)}{d}\)

\(\Big \downarrow \) 15

\(\displaystyle \int \frac {a^2+b^2 \tan (c+d x)^2}{\sec (c+d x)^7}dx-\frac {2 a b \cos ^7(c+d x)}{7 d}\)

\(\Big \downarrow \) 4159

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

\(\Big \downarrow \) 290

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

\(\Big \downarrow \) 2009

\(\displaystyle \frac {-\frac {1}{7} \left (a^2-b^2\right ) \sin ^7(c+d x)+\frac {1}{5} \left (3 a^2-2 b^2\right ) \sin ^5(c+d x)-\frac {1}{3} \left (3 a^2-b^2\right ) \sin ^3(c+d x)+a^2 \sin (c+d x)}{d}-\frac {2 a b \cos ^7(c+d x)}{7 d}\)

Input:

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

Output:

(-2*a*b*Cos[c + d*x]^7)/(7*d) + (a^2*Sin[c + d*x] - ((3*a^2 - b^2)*Sin[c + 
 d*x]^3)/3 + ((3*a^2 - 2*b^2)*Sin[c + d*x]^5)/5 - ((a^2 - b^2)*Sin[c + d*x 
]^7)/7)/d
 

Defintions of rubi rules used

rule 15
Int[(a_.)*(x_)^(m_.), x_Symbol] :> Simp[a*(x^(m + 1)/(m + 1)), x] /; FreeQ[ 
{a, m}, x] && NeQ[m, -1]
 

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 290
Int[((a_) + (b_.)*(x_)^2)^(p_.)*((c_) + (d_.)*(x_)^2)^(q_.), x_Symbol] :> I 
nt[ExpandIntegrand[(a + b*x^2)^p*(c + d*x^2)^q, x], x] /; FreeQ[{a, b, c, d 
}, x] && NeQ[b*c - a*d, 0] && IGtQ[p, 0] && IGtQ[q, 0]
 

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 3045
Int[(cos[(e_.) + (f_.)*(x_)]*(a_.))^(m_.)*sin[(e_.) + (f_.)*(x_)]^(n_.), x_ 
Symbol] :> Simp[-(a*f)^(-1)   Subst[Int[x^m*(1 - x^2/a^2)^((n - 1)/2), x], 
x, a*Cos[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n - 1)/2] && 
 !(IntegerQ[(m - 1)/2] && GtQ[m, 0] && LeQ[m, n])
 

rule 3991
Int[sec[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n 
_), x_Symbol] :> Module[{k}, Int[Sec[e + f*x]^m*Sum[Binomial[n, 2*k]*a^(n - 
 2*k)*b^(2*k)*Tan[e + f*x]^(2*k), {k, 0, n/2}], x] + Int[Sec[e + f*x]^m*Tan 
[e + f*x]*Sum[Binomial[n, 2*k + 1]*a^(n - 2*k - 1)*b^(2*k + 1)*Tan[e + f*x] 
^(2*k), {k, 0, (n - 1)/2}], x]] /; FreeQ[{a, b, e, f}, x] && NeQ[a^2 + b^2, 
 0] && IntegerQ[(m - 1)/2] && IGtQ[n, 0]
 

rule 4159
Int[sec[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]^(n_ 
))^(p_.), x_Symbol] :> With[{ff = FreeFactors[Sin[e + f*x], x]}, Simp[ff/f 
  Subst[Int[ExpandToSum[b*(ff*x)^n + a*(1 - ff^2*x^2)^(n/2), x]^p/(1 - ff^2 
*x^2)^((m + n*p + 1)/2), x], x, Sin[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f} 
, x] && IntegerQ[(m - 1)/2] && IntegerQ[n/2] && IntegerQ[p]
 
Maple [A] (verified)

Time = 67.70 (sec) , antiderivative size = 108, normalized size of antiderivative = 1.01

method result size
derivativedivides \(\frac {b^{2} \left (-\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )^{6}}{7}+\frac {\left (\frac {8}{3}+\cos \left (d x +c \right )^{4}+\frac {4 \cos \left (d x +c \right )^{2}}{3}\right ) \sin \left (d x +c \right )}{35}\right )-\frac {2 a b \cos \left (d x +c \right )^{7}}{7}+\frac {a^{2} \left (\frac {16}{5}+\cos \left (d x +c \right )^{6}+\frac {6 \cos \left (d x +c \right )^{4}}{5}+\frac {8 \cos \left (d x +c \right )^{2}}{5}\right ) \sin \left (d x +c \right )}{7}}{d}\) \(108\)
default \(\frac {b^{2} \left (-\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )^{6}}{7}+\frac {\left (\frac {8}{3}+\cos \left (d x +c \right )^{4}+\frac {4 \cos \left (d x +c \right )^{2}}{3}\right ) \sin \left (d x +c \right )}{35}\right )-\frac {2 a b \cos \left (d x +c \right )^{7}}{7}+\frac {a^{2} \left (\frac {16}{5}+\cos \left (d x +c \right )^{6}+\frac {6 \cos \left (d x +c \right )^{4}}{5}+\frac {8 \cos \left (d x +c \right )^{2}}{5}\right ) \sin \left (d x +c \right )}{7}}{d}\) \(108\)
risch \(-\frac {5 a b \cos \left (d x +c \right )}{32 d}+\frac {35 a^{2} \sin \left (d x +c \right )}{64 d}+\frac {5 \sin \left (d x +c \right ) b^{2}}{64 d}-\frac {a b \cos \left (7 d x +7 c \right )}{224 d}+\frac {\sin \left (7 d x +7 c \right ) a^{2}}{448 d}-\frac {\sin \left (7 d x +7 c \right ) b^{2}}{448 d}-\frac {a b \cos \left (5 d x +5 c \right )}{32 d}+\frac {7 \sin \left (5 d x +5 c \right ) a^{2}}{320 d}-\frac {3 \sin \left (5 d x +5 c \right ) b^{2}}{320 d}-\frac {3 a b \cos \left (3 d x +3 c \right )}{32 d}+\frac {7 \sin \left (3 d x +3 c \right ) a^{2}}{64 d}-\frac {\sin \left (3 d x +3 c \right ) b^{2}}{192 d}\) \(193\)

Input:

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

Output:

1/d*(b^2*(-1/7*sin(d*x+c)*cos(d*x+c)^6+1/35*(8/3+cos(d*x+c)^4+4/3*cos(d*x+ 
c)^2)*sin(d*x+c))-2/7*a*b*cos(d*x+c)^7+1/7*a^2*(16/5+cos(d*x+c)^6+6/5*cos( 
d*x+c)^4+8/5*cos(d*x+c)^2)*sin(d*x+c))
 

Fricas [A] (verification not implemented)

Time = 0.09 (sec) , antiderivative size = 94, normalized size of antiderivative = 0.88 \[ \int \cos ^7(c+d x) (a+b \tan (c+d x))^2 \, dx=-\frac {30 \, a b \cos \left (d x + c\right )^{7} - {\left (15 \, {\left (a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{6} + 3 \, {\left (6 \, a^{2} + b^{2}\right )} \cos \left (d x + c\right )^{4} + 4 \, {\left (6 \, a^{2} + b^{2}\right )} \cos \left (d x + c\right )^{2} + 48 \, a^{2} + 8 \, b^{2}\right )} \sin \left (d x + c\right )}{105 \, d} \] Input:

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

Output:

-1/105*(30*a*b*cos(d*x + c)^7 - (15*(a^2 - b^2)*cos(d*x + c)^6 + 3*(6*a^2 
+ b^2)*cos(d*x + c)^4 + 4*(6*a^2 + b^2)*cos(d*x + c)^2 + 48*a^2 + 8*b^2)*s 
in(d*x + c))/d
 

Sympy [F]

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

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

Output:

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

Maxima [A] (verification not implemented)

Time = 0.05 (sec) , antiderivative size = 98, normalized size of antiderivative = 0.92 \[ \int \cos ^7(c+d x) (a+b \tan (c+d x))^2 \, dx=-\frac {30 \, a b \cos \left (d x + c\right )^{7} + 3 \, {\left (5 \, \sin \left (d x + c\right )^{7} - 21 \, \sin \left (d x + c\right )^{5} + 35 \, \sin \left (d x + c\right )^{3} - 35 \, \sin \left (d x + c\right )\right )} a^{2} - {\left (15 \, \sin \left (d x + c\right )^{7} - 42 \, \sin \left (d x + c\right )^{5} + 35 \, \sin \left (d x + c\right )^{3}\right )} b^{2}}{105 \, d} \] Input:

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

Output:

-1/105*(30*a*b*cos(d*x + c)^7 + 3*(5*sin(d*x + c)^7 - 21*sin(d*x + c)^5 + 
35*sin(d*x + c)^3 - 35*sin(d*x + c))*a^2 - (15*sin(d*x + c)^7 - 42*sin(d*x 
 + c)^5 + 35*sin(d*x + c)^3)*b^2)/d
 

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 52002 vs. \(2 (99) = 198\).

Time = 54.05 (sec) , antiderivative size = 52002, normalized size of antiderivative = 486.00 \[ \int \cos ^7(c+d x) (a+b \tan (c+d x))^2 \, dx=\text {Too large to display} \] Input:

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

Output:

-1/26880*(945*pi*a*b*sgn(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2*ta 
n(1/2*c) + tan(1/2*d*x)^2 - tan(1/2*c)^2 + 2*tan(1/2*c) - 1)*sgn(tan(1/2*d 
*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)*tan(1/2*c)^2 - tan(1/2*d*x)^2 + tan(1/ 
2*c)^2 + 2*tan(1/2*d*x) - 1)*tan(1/2*d*x)^14*tan(1/2*c)^14 + 945*pi*a*b*sg 
n(tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)^2*tan(1/2*c) + tan(1/2*d*x) 
^2 - tan(1/2*c)^2 - 2*tan(1/2*c) - 1)*sgn(tan(1/2*d*x)^2*tan(1/2*c)^2 - 2* 
tan(1/2*d*x)*tan(1/2*c)^2 - tan(1/2*d*x)^2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) 
 - 1)*tan(1/2*d*x)^14*tan(1/2*c)^14 + 945*pi*a*b*sgn(tan(1/2*d*x)^2*tan(1/ 
2*c)^2 + 2*tan(1/2*d*x)^2*tan(1/2*c) + tan(1/2*d*x)^2 - tan(1/2*c)^2 + 2*t 
an(1/2*c) - 1)*tan(1/2*d*x)^14*tan(1/2*c)^14 + 945*pi*a*b*sgn(tan(1/2*d*x) 
^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)^2*tan(1/2*c) + tan(1/2*d*x)^2 - tan(1/2*c 
)^2 - 2*tan(1/2*c) - 1)*tan(1/2*d*x)^14*tan(1/2*c)^14 + 8400*pi*a*b*sgn(ta 
n(1/2*d*x)^2*tan(1/2*c)^2 - tan(1/2*d*x)^2 - 4*tan(1/2*d*x)*tan(1/2*c) - t 
an(1/2*c)^2 + 1)*tan(1/2*d*x)^14*tan(1/2*c)^14 + 6615*pi*a*b*sgn(tan(1/2*d 
*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2*tan(1/2*c) + tan(1/2*d*x)^2 - tan(1/ 
2*c)^2 + 2*tan(1/2*c) - 1)*sgn(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x 
)*tan(1/2*c)^2 - tan(1/2*d*x)^2 + tan(1/2*c)^2 + 2*tan(1/2*d*x) - 1)*tan(1 
/2*d*x)^14*tan(1/2*c)^12 + 6615*pi*a*b*sgn(tan(1/2*d*x)^2*tan(1/2*c)^2 - 2 
*tan(1/2*d*x)^2*tan(1/2*c) + tan(1/2*d*x)^2 - tan(1/2*c)^2 - 2*tan(1/2*c) 
- 1)*sgn(tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)*tan(1/2*c)^2 - ta...
 

Mupad [B] (verification not implemented)

Time = 0.96 (sec) , antiderivative size = 176, normalized size of antiderivative = 1.64 \[ \int \cos ^7(c+d x) (a+b \tan (c+d x))^2 \, dx=\frac {16\,a^2\,\sin \left (c+d\,x\right )}{35\,d}+\frac {8\,b^2\,\sin \left (c+d\,x\right )}{105\,d}+\frac {8\,a^2\,{\cos \left (c+d\,x\right )}^2\,\sin \left (c+d\,x\right )}{35\,d}+\frac {6\,a^2\,{\cos \left (c+d\,x\right )}^4\,\sin \left (c+d\,x\right )}{35\,d}+\frac {a^2\,{\cos \left (c+d\,x\right )}^6\,\sin \left (c+d\,x\right )}{7\,d}+\frac {4\,b^2\,{\cos \left (c+d\,x\right )}^2\,\sin \left (c+d\,x\right )}{105\,d}+\frac {b^2\,{\cos \left (c+d\,x\right )}^4\,\sin \left (c+d\,x\right )}{35\,d}-\frac {b^2\,{\cos \left (c+d\,x\right )}^6\,\sin \left (c+d\,x\right )}{7\,d}-\frac {2\,a\,b\,{\cos \left (c+d\,x\right )}^7}{7\,d} \] Input:

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

Output:

(16*a^2*sin(c + d*x))/(35*d) + (8*b^2*sin(c + d*x))/(105*d) + (8*a^2*cos(c 
 + d*x)^2*sin(c + d*x))/(35*d) + (6*a^2*cos(c + d*x)^4*sin(c + d*x))/(35*d 
) + (a^2*cos(c + d*x)^6*sin(c + d*x))/(7*d) + (4*b^2*cos(c + d*x)^2*sin(c 
+ d*x))/(105*d) + (b^2*cos(c + d*x)^4*sin(c + d*x))/(35*d) - (b^2*cos(c + 
d*x)^6*sin(c + d*x))/(7*d) - (2*a*b*cos(c + d*x)^7)/(7*d)
 

Reduce [B] (verification not implemented)

Time = 0.22 (sec) , antiderivative size = 163, normalized size of antiderivative = 1.52 \[ \int \cos ^7(c+d x) (a+b \tan (c+d x))^2 \, dx=\frac {30 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{6} a b -90 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{4} a b +90 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{2} a b -30 \cos \left (d x +c \right ) a b -15 \sin \left (d x +c \right )^{7} a^{2}+15 \sin \left (d x +c \right )^{7} b^{2}+63 \sin \left (d x +c \right )^{5} a^{2}-42 \sin \left (d x +c \right )^{5} b^{2}-105 \sin \left (d x +c \right )^{3} a^{2}+35 \sin \left (d x +c \right )^{3} b^{2}+105 \sin \left (d x +c \right ) a^{2}+30 a b}{105 d} \] Input:

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

Output:

(30*cos(c + d*x)*sin(c + d*x)**6*a*b - 90*cos(c + d*x)*sin(c + d*x)**4*a*b 
 + 90*cos(c + d*x)*sin(c + d*x)**2*a*b - 30*cos(c + d*x)*a*b - 15*sin(c + 
d*x)**7*a**2 + 15*sin(c + d*x)**7*b**2 + 63*sin(c + d*x)**5*a**2 - 42*sin( 
c + d*x)**5*b**2 - 105*sin(c + d*x)**3*a**2 + 35*sin(c + d*x)**3*b**2 + 10 
5*sin(c + d*x)*a**2 + 30*a*b)/(105*d)