\(\int \tan (c+d x) (a+b \tan (c+d x)) (B \tan (c+d x)+C \tan ^2(c+d x)) \, dx\) [1]

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [A] (verified)
Fricas [A] (verification not implemented)
Sympy [A] (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 = 36, antiderivative size = 87 \[ \int \tan (c+d x) (a+b \tan (c+d x)) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=-((a B-b C) x)+\frac {(b B+a C) \log (\cos (c+d x))}{d}+\frac {(a B-b C) \tan (c+d x)}{d}+\frac {(b B+a C) \tan ^2(c+d x)}{2 d}+\frac {b C \tan ^3(c+d x)}{3 d} \] Output:

-(B*a-C*b)*x+(B*b+C*a)*ln(cos(d*x+c))/d+(B*a-C*b)*tan(d*x+c)/d+1/2*(B*b+C* 
a)*tan(d*x+c)^2/d+1/3*b*C*tan(d*x+c)^3/d
 

Mathematica [A] (verified)

Time = 0.33 (sec) , antiderivative size = 124, normalized size of antiderivative = 1.43 \[ \int \tan (c+d x) (a+b \tan (c+d x)) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=-\frac {a B \arctan (\tan (c+d x))}{d}+\frac {b C \arctan (\tan (c+d x))}{d}+\frac {b B \left (2 \log (\cos (c+d x))+\sec ^2(c+d x)\right )}{2 d}+\frac {a C \left (2 \log (\cos (c+d x))+\sec ^2(c+d x)\right )}{2 d}+\frac {a B \tan (c+d x)}{d}-\frac {b C \tan (c+d x)}{d}+\frac {b C \tan ^3(c+d x)}{3 d} \] Input:

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

Output:

-((a*B*ArcTan[Tan[c + d*x]])/d) + (b*C*ArcTan[Tan[c + d*x]])/d + (b*B*(2*L 
og[Cos[c + d*x]] + Sec[c + d*x]^2))/(2*d) + (a*C*(2*Log[Cos[c + d*x]] + Se 
c[c + d*x]^2))/(2*d) + (a*B*Tan[c + d*x])/d - (b*C*Tan[c + d*x])/d + (b*C* 
Tan[c + d*x]^3)/(3*d)
 

Rubi [A] (verified)

Time = 0.96 (sec) , antiderivative size = 87, normalized size of antiderivative = 1.00, number of steps used = 10, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.278, Rules used = {3042, 4115, 3042, 4075, 3042, 4011, 3042, 4008, 3042, 3956}

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 (c+d x) (a+b \tan (c+d x)) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \tan (c+d x) (a+b \tan (c+d x)) \left (B \tan (c+d x)+C \tan (c+d x)^2\right )dx\)

\(\Big \downarrow \) 4115

\(\displaystyle \int \tan ^2(c+d x) (a+b \tan (c+d x)) (B+C \tan (c+d x))dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \tan (c+d x)^2 (a+b \tan (c+d x)) (B+C \tan (c+d x))dx\)

\(\Big \downarrow \) 4075

\(\displaystyle \int \tan ^2(c+d x) (a B-b C+(b B+a C) \tan (c+d x))dx+\frac {b C \tan ^3(c+d x)}{3 d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \tan (c+d x)^2 (a B-b C+(b B+a C) \tan (c+d x))dx+\frac {b C \tan ^3(c+d x)}{3 d}\)

\(\Big \downarrow \) 4011

\(\displaystyle \int \tan (c+d x) (-b B-a C+(a B-b C) \tan (c+d x))dx+\frac {(a C+b B) \tan ^2(c+d x)}{2 d}+\frac {b C \tan ^3(c+d x)}{3 d}\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \tan (c+d x) (-b B-a C+(a B-b C) \tan (c+d x))dx+\frac {(a C+b B) \tan ^2(c+d x)}{2 d}+\frac {b C \tan ^3(c+d x)}{3 d}\)

\(\Big \downarrow \) 4008

\(\displaystyle -(a C+b B) \int \tan (c+d x)dx+\frac {(a C+b B) \tan ^2(c+d x)}{2 d}+\frac {(a B-b C) \tan (c+d x)}{d}-x (a B-b C)+\frac {b C \tan ^3(c+d x)}{3 d}\)

\(\Big \downarrow \) 3042

\(\displaystyle -(a C+b B) \int \tan (c+d x)dx+\frac {(a C+b B) \tan ^2(c+d x)}{2 d}+\frac {(a B-b C) \tan (c+d x)}{d}-x (a B-b C)+\frac {b C \tan ^3(c+d x)}{3 d}\)

\(\Big \downarrow \) 3956

\(\displaystyle \frac {(a C+b B) \tan ^2(c+d x)}{2 d}+\frac {(a B-b C) \tan (c+d x)}{d}+\frac {(a C+b B) \log (\cos (c+d x))}{d}-x (a B-b C)+\frac {b C \tan ^3(c+d x)}{3 d}\)

Input:

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

Output:

-((a*B - b*C)*x) + ((b*B + a*C)*Log[Cos[c + d*x]])/d + ((a*B - b*C)*Tan[c 
+ d*x])/d + ((b*B + a*C)*Tan[c + d*x]^2)/(2*d) + (b*C*Tan[c + d*x]^3)/(3*d 
)
 

Defintions of rubi rules used

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

rule 3956
Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d 
*x], x]]/d, x] /; FreeQ[{c, d}, x]
 

rule 4008
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.) 
*(x_)]), x_Symbol] :> Simp[(a*c - b*d)*x, x] + (Simp[b*d*(Tan[e + f*x]/f), 
x] + Simp[(b*c + a*d)   Int[Tan[e + f*x], x], x]) /; FreeQ[{a, b, c, d, e, 
f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]
 

rule 4011
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
 (f_.)*(x_)]), x_Symbol] :> Simp[d*((a + b*Tan[e + f*x])^m/(f*m)), x] + Int 
[(a + b*Tan[e + f*x])^(m - 1)*Simp[a*c - b*d + (b*c + a*d)*Tan[e + f*x], x] 
, x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 
 0] && GtQ[m, 0]
 

rule 4075
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) 
+ (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[B 
*d*((a + b*Tan[e + f*x])^(m + 1)/(b*f*(m + 1))), x] + Int[(a + b*Tan[e + f* 
x])^m*Simp[A*c - B*d + (B*c + A*d)*Tan[e + f*x], x], x] /; FreeQ[{a, b, c, 
d, e, f, A, B, m}, x] && NeQ[b*c - a*d, 0] &&  !LeQ[m, -1]
 

rule 4115
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*tan[(e_.) 
+ (f_.)*(x_)])^(n_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_ 
.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[1/b^2   Int[(a + b*Tan[e + f*x])^(m 
+ 1)*(c + d*Tan[e + f*x])^n*(b*B - a*C + b*C*Tan[e + f*x]), x], x] /; FreeQ 
[{a, b, c, d, e, f, A, B, C, m, n}, x] && NeQ[b*c - a*d, 0] && EqQ[A*b^2 - 
a*b*B + a^2*C, 0]
 
Maple [A] (verified)

Time = 0.16 (sec) , antiderivative size = 88, normalized size of antiderivative = 1.01

method result size
norman \(\left (-B a +C b \right ) x +\frac {\left (B a -C b \right ) \tan \left (d x +c \right )}{d}+\frac {\left (B b +C a \right ) \tan \left (d x +c \right )^{2}}{2 d}+\frac {b C \tan \left (d x +c \right )^{3}}{3 d}-\frac {\left (B b +C a \right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2 d}\) \(88\)
parts \(\frac {\left (B b +C a \right ) \left (\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 {B a \left (\tan \left (d x +c \right )-\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}+\frac {C b \left (\frac {\tan \left (d x +c \right )^{3}}{3}-\tan \left (d x +c \right )+\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}\) \(91\)
derivativedivides \(\frac {\frac {C b \tan \left (d x +c \right )^{3}}{3}+\frac {B b \tan \left (d x +c \right )^{2}}{2}+\frac {C a \tan \left (d x +c \right )^{2}}{2}+B a \tan \left (d x +c \right )-C b \tan \left (d x +c \right )+\frac {\left (-B b -C a \right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2}+\left (-B a +C b \right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) \(99\)
default \(\frac {\frac {C b \tan \left (d x +c \right )^{3}}{3}+\frac {B b \tan \left (d x +c \right )^{2}}{2}+\frac {C a \tan \left (d x +c \right )^{2}}{2}+B a \tan \left (d x +c \right )-C b \tan \left (d x +c \right )+\frac {\left (-B b -C a \right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2}+\left (-B a +C b \right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) \(99\)
parallelrisch \(-\frac {-2 C b \tan \left (d x +c \right )^{3}+6 B a d x -3 B b \tan \left (d x +c \right )^{2}-6 C b d x -3 C a \tan \left (d x +c \right )^{2}+3 B \ln \left (1+\tan \left (d x +c \right )^{2}\right ) b -6 B a \tan \left (d x +c \right )+3 C \ln \left (1+\tan \left (d x +c \right )^{2}\right ) a +6 C b \tan \left (d x +c \right )}{6 d}\) \(105\)
risch \(-i B b x -i C a x -B a x +C b x -\frac {2 i B b c}{d}-\frac {2 i C a c}{d}+\frac {2 i \left (-3 i B b \,{\mathrm e}^{4 i \left (d x +c \right )}-3 i C a \,{\mathrm e}^{4 i \left (d x +c \right )}+3 B a \,{\mathrm e}^{4 i \left (d x +c \right )}-6 C b \,{\mathrm e}^{4 i \left (d x +c \right )}-3 i B b \,{\mathrm e}^{2 i \left (d x +c \right )}-3 i C a \,{\mathrm e}^{2 i \left (d x +c \right )}+6 B a \,{\mathrm e}^{2 i \left (d x +c \right )}-6 b \,{\mathrm e}^{2 i \left (d x +c \right )} C +3 B a -4 C b \right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3}}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B b}{d}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) C a}{d}\) \(213\)

Input:

int(tan(d*x+c)*(a+b*tan(d*x+c))*(B*tan(d*x+c)+C*tan(d*x+c)^2),x,method=_RE 
TURNVERBOSE)
 

Output:

(-B*a+C*b)*x+(B*a-C*b)*tan(d*x+c)/d+1/2*(B*b+C*a)*tan(d*x+c)^2/d+1/3*b*C*t 
an(d*x+c)^3/d-1/2*(B*b+C*a)/d*ln(1+tan(d*x+c)^2)
 

Fricas [A] (verification not implemented)

Time = 0.08 (sec) , antiderivative size = 85, normalized size of antiderivative = 0.98 \[ \int \tan (c+d x) (a+b \tan (c+d x)) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=\frac {2 \, C b \tan \left (d x + c\right )^{3} - 6 \, {\left (B a - C b\right )} d x + 3 \, {\left (C a + B b\right )} \tan \left (d x + c\right )^{2} + 3 \, {\left (C a + B b\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 6 \, {\left (B a - C b\right )} \tan \left (d x + c\right )}{6 \, d} \] Input:

integrate(tan(d*x+c)*(a+b*tan(d*x+c))*(B*tan(d*x+c)+C*tan(d*x+c)^2),x, alg 
orithm="fricas")
 

Output:

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

Sympy [A] (verification not implemented)

Time = 0.12 (sec) , antiderivative size = 139, normalized size of antiderivative = 1.60 \[ \int \tan (c+d x) (a+b \tan (c+d x)) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=\begin {cases} - B a x + \frac {B a \tan {\left (c + d x \right )}}{d} - \frac {B b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {B b \tan ^{2}{\left (c + d x \right )}}{2 d} - \frac {C a \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {C a \tan ^{2}{\left (c + d x \right )}}{2 d} + C b x + \frac {C b \tan ^{3}{\left (c + d x \right )}}{3 d} - \frac {C b \tan {\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\x \left (a + b \tan {\left (c \right )}\right ) \left (B \tan {\left (c \right )} + C \tan ^{2}{\left (c \right )}\right ) \tan {\left (c \right )} & \text {otherwise} \end {cases} \] Input:

integrate(tan(d*x+c)*(a+b*tan(d*x+c))*(B*tan(d*x+c)+C*tan(d*x+c)**2),x)
 

Output:

Piecewise((-B*a*x + B*a*tan(c + d*x)/d - B*b*log(tan(c + d*x)**2 + 1)/(2*d 
) + B*b*tan(c + d*x)**2/(2*d) - C*a*log(tan(c + d*x)**2 + 1)/(2*d) + C*a*t 
an(c + d*x)**2/(2*d) + C*b*x + C*b*tan(c + d*x)**3/(3*d) - C*b*tan(c + d*x 
)/d, Ne(d, 0)), (x*(a + b*tan(c))*(B*tan(c) + C*tan(c)**2)*tan(c), True))
 

Maxima [A] (verification not implemented)

Time = 0.11 (sec) , antiderivative size = 86, normalized size of antiderivative = 0.99 \[ \int \tan (c+d x) (a+b \tan (c+d x)) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=\frac {2 \, C b \tan \left (d x + c\right )^{3} + 3 \, {\left (C a + B b\right )} \tan \left (d x + c\right )^{2} - 6 \, {\left (B a - C b\right )} {\left (d x + c\right )} - 3 \, {\left (C a + B b\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 6 \, {\left (B a - C b\right )} \tan \left (d x + c\right )}{6 \, d} \] Input:

integrate(tan(d*x+c)*(a+b*tan(d*x+c))*(B*tan(d*x+c)+C*tan(d*x+c)^2),x, alg 
orithm="maxima")
                                                                                    
                                                                                    
 

Output:

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

Giac [A] (verification not implemented)

Time = 0.52 (sec) , antiderivative size = 119, normalized size of antiderivative = 1.37 \[ \int \tan (c+d x) (a+b \tan (c+d x)) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=-\frac {{\left (B a - C b\right )} {\left (d x + c\right )}}{d} - \frac {{\left (C a + B b\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{2 \, d} + \frac {2 \, C b d^{2} \tan \left (d x + c\right )^{3} + 3 \, C a d^{2} \tan \left (d x + c\right )^{2} + 3 \, B b d^{2} \tan \left (d x + c\right )^{2} + 6 \, B a d^{2} \tan \left (d x + c\right ) - 6 \, C b d^{2} \tan \left (d x + c\right )}{6 \, d^{3}} \] Input:

integrate(tan(d*x+c)*(a+b*tan(d*x+c))*(B*tan(d*x+c)+C*tan(d*x+c)^2),x, alg 
orithm="giac")
 

Output:

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

Mupad [B] (verification not implemented)

Time = 5.62 (sec) , antiderivative size = 84, normalized size of antiderivative = 0.97 \[ \int \tan (c+d x) (a+b \tan (c+d x)) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (B\,a-C\,b\right )-\ln \left ({\mathrm {tan}\left (c+d\,x\right )}^2+1\right )\,\left (\frac {B\,b}{2}+\frac {C\,a}{2}\right )+{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (\frac {B\,b}{2}+\frac {C\,a}{2}\right )-d\,x\,\left (B\,a-C\,b\right )+\frac {C\,b\,{\mathrm {tan}\left (c+d\,x\right )}^3}{3}}{d} \] Input:

int(tan(c + d*x)*(B*tan(c + d*x) + C*tan(c + d*x)^2)*(a + b*tan(c + d*x)), 
x)
 

Output:

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

Reduce [B] (verification not implemented)

Time = 0.16 (sec) , antiderivative size = 106, normalized size of antiderivative = 1.22 \[ \int \tan (c+d x) (a+b \tan (c+d x)) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right ) \, dx=\frac {-3 \,\mathrm {log}\left (\tan \left (d x +c \right )^{2}+1\right ) a c -3 \,\mathrm {log}\left (\tan \left (d x +c \right )^{2}+1\right ) b^{2}+2 \tan \left (d x +c \right )^{3} b c +3 \tan \left (d x +c \right )^{2} a c +3 \tan \left (d x +c \right )^{2} b^{2}+6 \tan \left (d x +c \right ) a b -6 \tan \left (d x +c \right ) b c -6 a b d x +6 b c d x}{6 d} \] Input:

int(tan(d*x+c)*(a+b*tan(d*x+c))*(B*tan(d*x+c)+C*tan(d*x+c)^2),x)
 

Output:

( - 3*log(tan(c + d*x)**2 + 1)*a*c - 3*log(tan(c + d*x)**2 + 1)*b**2 + 2*t 
an(c + d*x)**3*b*c + 3*tan(c + d*x)**2*a*c + 3*tan(c + d*x)**2*b**2 + 6*ta 
n(c + d*x)*a*b - 6*tan(c + d*x)*b*c - 6*a*b*d*x + 6*b*c*d*x)/(6*d)