\(\int (c+d x) (a+b \tan (e+f x))^3 \, dx\) [51]

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

Optimal result

Integrand size = 18, antiderivative size = 275 \[ \int (c+d x) (a+b \tan (e+f x))^3 \, dx=\frac {b^3 d x}{2 f}+\frac {a^3 (c+d x)^2}{2 d}+\frac {3 i a^2 b (c+d x)^2}{2 d}-\frac {3 a b^2 (c+d x)^2}{2 d}-\frac {i b^3 (c+d x)^2}{2 d}-\frac {3 a^2 b (c+d x) \log \left (1+e^{2 i (e+f x)}\right )}{f}+\frac {b^3 (c+d x) \log \left (1+e^{2 i (e+f x)}\right )}{f}+\frac {3 a b^2 d \log (\cos (e+f x))}{f^2}+\frac {3 i a^2 b d \operatorname {PolyLog}\left (2,-e^{2 i (e+f x)}\right )}{2 f^2}-\frac {i b^3 d \operatorname {PolyLog}\left (2,-e^{2 i (e+f x)}\right )}{2 f^2}-\frac {b^3 d \tan (e+f x)}{2 f^2}+\frac {3 a b^2 (c+d x) \tan (e+f x)}{f}+\frac {b^3 (c+d x) \tan ^2(e+f x)}{2 f} \] Output:

1/2*b^3*d*x/f+1/2*a^3*(d*x+c)^2/d+3/2*I*a^2*b*(d*x+c)^2/d-3/2*a*b^2*(d*x+c 
)^2/d-1/2*I*b^3*(d*x+c)^2/d-3*a^2*b*(d*x+c)*ln(1+exp(2*I*(f*x+e)))/f+b^3*( 
d*x+c)*ln(1+exp(2*I*(f*x+e)))/f+3*a*b^2*d*ln(cos(f*x+e))/f^2+3/2*I*a^2*b*d 
*polylog(2,-exp(2*I*(f*x+e)))/f^2-1/2*I*b^3*d*polylog(2,-exp(2*I*(f*x+e))) 
/f^2-1/2*b^3*d*tan(f*x+e)/f^2+3*a*b^2*(d*x+c)*tan(f*x+e)/f+1/2*b^3*(d*x+c) 
*tan(f*x+e)^2/f
 

Mathematica [A] (verified)

Time = 8.10 (sec) , antiderivative size = 277, normalized size of antiderivative = 1.01 \[ \int (c+d x) (a+b \tan (e+f x))^3 \, dx=\frac {\cos (e+f x) \left (\cos ^2(e+f x) \left (-\left ((e+f x) \left (-3 i a^2 b d (e+f x)+i b^3 d (e+f x)+3 a b^2 (-d e+2 c f+d f x)+a^3 (-2 c f+d (e-f x))\right )\right )+2 b \left (-3 a^2+b^2\right ) d (e+f x) \log \left (1+e^{2 i (e+f x)}\right )+2 b \left (3 a b d+3 a^2 (d e-c f)+b^2 (-d e+c f)\right ) \log (\cos (e+f x))\right )-i b \left (-3 a^2+b^2\right ) d \cos ^2(e+f x) \operatorname {PolyLog}\left (2,-e^{2 i (e+f x)}\right )+\frac {1}{2} b^2 (2 b f (c+d x)+(-b d+6 a f (c+d x)) \sin (2 (e+f x)))\right ) (a+b \tan (e+f x))^3}{2 f^2 (a \cos (e+f x)+b \sin (e+f x))^3} \] Input:

Integrate[(c + d*x)*(a + b*Tan[e + f*x])^3,x]
 

Output:

(Cos[e + f*x]*(Cos[e + f*x]^2*(-((e + f*x)*((-3*I)*a^2*b*d*(e + f*x) + I*b 
^3*d*(e + f*x) + 3*a*b^2*(-(d*e) + 2*c*f + d*f*x) + a^3*(-2*c*f + d*(e - f 
*x)))) + 2*b*(-3*a^2 + b^2)*d*(e + f*x)*Log[1 + E^((2*I)*(e + f*x))] + 2*b 
*(3*a*b*d + 3*a^2*(d*e - c*f) + b^2*(-(d*e) + c*f))*Log[Cos[e + f*x]]) - I 
*b*(-3*a^2 + b^2)*d*Cos[e + f*x]^2*PolyLog[2, -E^((2*I)*(e + f*x))] + (b^2 
*(2*b*f*(c + d*x) + (-(b*d) + 6*a*f*(c + d*x))*Sin[2*(e + f*x)]))/2)*(a + 
b*Tan[e + f*x])^3)/(2*f^2*(a*Cos[e + f*x] + b*Sin[e + f*x])^3)
 

Rubi [A] (verified)

Time = 0.59 (sec) , antiderivative size = 275, 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.167, Rules used = {3042, 4205, 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 (c+d x) (a+b \tan (e+f x))^3 \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (c+d x) (a+b \tan (e+f x))^3dx\)

\(\Big \downarrow \) 4205

\(\displaystyle \int \left (a^3 (c+d x)+3 a^2 b (c+d x) \tan (e+f x)+3 a b^2 (c+d x) \tan ^2(e+f x)+b^3 (c+d x) \tan ^3(e+f x)\right )dx\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {a^3 (c+d x)^2}{2 d}-\frac {3 a^2 b (c+d x) \log \left (1+e^{2 i (e+f x)}\right )}{f}+\frac {3 i a^2 b (c+d x)^2}{2 d}+\frac {3 i a^2 b d \operatorname {PolyLog}\left (2,-e^{2 i (e+f x)}\right )}{2 f^2}+\frac {3 a b^2 (c+d x) \tan (e+f x)}{f}-\frac {3 a b^2 (c+d x)^2}{2 d}+\frac {3 a b^2 d \log (\cos (e+f x))}{f^2}+\frac {b^3 (c+d x) \log \left (1+e^{2 i (e+f x)}\right )}{f}+\frac {b^3 (c+d x) \tan ^2(e+f x)}{2 f}-\frac {i b^3 (c+d x)^2}{2 d}-\frac {i b^3 d \operatorname {PolyLog}\left (2,-e^{2 i (e+f x)}\right )}{2 f^2}-\frac {b^3 d \tan (e+f x)}{2 f^2}+\frac {b^3 d x}{2 f}\)

Input:

Int[(c + d*x)*(a + b*Tan[e + f*x])^3,x]
 

Output:

(b^3*d*x)/(2*f) + (a^3*(c + d*x)^2)/(2*d) + (((3*I)/2)*a^2*b*(c + d*x)^2)/ 
d - (3*a*b^2*(c + d*x)^2)/(2*d) - ((I/2)*b^3*(c + d*x)^2)/d - (3*a^2*b*(c 
+ d*x)*Log[1 + E^((2*I)*(e + f*x))])/f + (b^3*(c + d*x)*Log[1 + E^((2*I)*( 
e + f*x))])/f + (3*a*b^2*d*Log[Cos[e + f*x]])/f^2 + (((3*I)/2)*a^2*b*d*Pol 
yLog[2, -E^((2*I)*(e + f*x))])/f^2 - ((I/2)*b^3*d*PolyLog[2, -E^((2*I)*(e 
+ f*x))])/f^2 - (b^3*d*Tan[e + f*x])/(2*f^2) + (3*a*b^2*(c + d*x)*Tan[e + 
f*x])/f + (b^3*(c + d*x)*Tan[e + f*x]^2)/(2*f)
 

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 4205
Int[((c_.) + (d_.)*(x_))^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.) 
, x_Symbol] :> Int[ExpandIntegrand[(c + d*x)^m, (a + b*Tan[e + f*x])^n, x], 
 x] /; FreeQ[{a, b, c, d, e, f, m}, x] && IGtQ[m, 0] && IGtQ[n, 0]
 
Maple [B] (verified)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 492 vs. \(2 (245 ) = 490\).

Time = 0.77 (sec) , antiderivative size = 493, normalized size of antiderivative = 1.79

method result size
risch \(-\frac {3 a \,b^{2} d \,x^{2}}{2}-3 a \,b^{2} c x -3 i a^{2} b c x +\frac {3 i a^{2} b d \,x^{2}}{2}+\frac {b^{3} d \ln \left (1+{\mathrm e}^{2 i \left (f x +e \right )}\right ) x}{f}-\frac {6 b^{2} a d \ln \left ({\mathrm e}^{i \left (f x +e \right )}\right )}{f^{2}}+\frac {3 b^{2} a d \ln \left (1+{\mathrm e}^{2 i \left (f x +e \right )}\right )}{f^{2}}+\frac {6 b \,a^{2} c \ln \left ({\mathrm e}^{i \left (f x +e \right )}\right )}{f}-\frac {3 b \,a^{2} c \ln \left (1+{\mathrm e}^{2 i \left (f x +e \right )}\right )}{f}+\frac {2 b^{3} e d \ln \left ({\mathrm e}^{i \left (f x +e \right )}\right )}{f^{2}}-\frac {i b^{3} d \,e^{2}}{f^{2}}-\frac {i b^{3} d \operatorname {polylog}\left (2, -{\mathrm e}^{2 i \left (f x +e \right )}\right )}{2 f^{2}}+\frac {a^{3} d \,x^{2}}{2}+a^{3} c x +\frac {b^{2} \left (6 i a d f x \,{\mathrm e}^{2 i \left (f x +e \right )}+6 i a c f \,{\mathrm e}^{2 i \left (f x +e \right )}+2 b d f x \,{\mathrm e}^{2 i \left (f x +e \right )}+6 i a d f x -i b d \,{\mathrm e}^{2 i \left (f x +e \right )}+2 b c f \,{\mathrm e}^{2 i \left (f x +e \right )}+6 i a c f -i b d \right )}{f^{2} \left (1+{\mathrm e}^{2 i \left (f x +e \right )}\right )^{2}}-\frac {2 b^{3} c \ln \left ({\mathrm e}^{i \left (f x +e \right )}\right )}{f}+\frac {b^{3} c \ln \left (1+{\mathrm e}^{2 i \left (f x +e \right )}\right )}{f}-\frac {i b^{3} d \,x^{2}}{2}+i b^{3} c x +\frac {6 i b \,a^{2} d e x}{f}-\frac {2 i b^{3} d e x}{f}+\frac {3 i a^{2} b d \operatorname {polylog}\left (2, -{\mathrm e}^{2 i \left (f x +e \right )}\right )}{2 f^{2}}-\frac {6 b e \,a^{2} d \ln \left ({\mathrm e}^{i \left (f x +e \right )}\right )}{f^{2}}-\frac {3 b \,a^{2} d \ln \left (1+{\mathrm e}^{2 i \left (f x +e \right )}\right ) x}{f}+\frac {3 i b \,a^{2} d \,e^{2}}{f^{2}}\) \(493\)

Input:

int((d*x+c)*(a+b*tan(f*x+e))^3,x,method=_RETURNVERBOSE)
 

Output:

-3/2*a*b^2*d*x^2-3*a*b^2*c*x+I*b^3*c*x+1/2*a^3*d*x^2+a^3*c*x+b^2*(6*I*a*d* 
f*x*exp(2*I*(f*x+e))+6*I*a*c*f*exp(2*I*(f*x+e))+2*b*d*f*x*exp(2*I*(f*x+e)) 
+6*I*a*d*f*x-I*b*d*exp(2*I*(f*x+e))+2*b*c*f*exp(2*I*(f*x+e))+6*I*a*c*f-I*b 
*d)/f^2/(1+exp(2*I*(f*x+e)))^2-2/f*b^3*c*ln(exp(I*(f*x+e)))+1/f*b^3*c*ln(1 
+exp(2*I*(f*x+e)))-1/2*I*b^3*d*x^2-3*I*a^2*b*c*x+3/2*I*a^2*b*d*x^2+1/f*b^3 
*d*ln(1+exp(2*I*(f*x+e)))*x-6/f^2*b^2*a*d*ln(exp(I*(f*x+e)))+3/f^2*b^2*a*d 
*ln(1+exp(2*I*(f*x+e)))+6/f*b*a^2*c*ln(exp(I*(f*x+e)))-3/f*b*a^2*c*ln(1+ex 
p(2*I*(f*x+e)))+2/f^2*b^3*e*d*ln(exp(I*(f*x+e)))-I/f^2*b^3*d*e^2-1/2*I*b^3 
*d*polylog(2,-exp(2*I*(f*x+e)))/f^2+6*I/f*b*a^2*d*e*x-6/f^2*b*e*a^2*d*ln(e 
xp(I*(f*x+e)))-3/f*b*a^2*d*ln(1+exp(2*I*(f*x+e)))*x+3*I/f^2*b*a^2*d*e^2-2* 
I/f*b^3*d*e*x+3/2*I*a^2*b*d*polylog(2,-exp(2*I*(f*x+e)))/f^2
 

Fricas [A] (verification not implemented)

Time = 0.08 (sec) , antiderivative size = 327, normalized size of antiderivative = 1.19 \[ \int (c+d x) (a+b \tan (e+f x))^3 \, dx=\frac {2 \, {\left (a^{3} - 3 \, a b^{2}\right )} d f^{2} x^{2} - i \, {\left (3 \, a^{2} b - b^{3}\right )} d {\rm Li}_2\left (\frac {2 \, {\left (i \, \tan \left (f x + e\right ) - 1\right )}}{\tan \left (f x + e\right )^{2} + 1} + 1\right ) + i \, {\left (3 \, a^{2} b - b^{3}\right )} d {\rm Li}_2\left (\frac {2 \, {\left (-i \, \tan \left (f x + e\right ) - 1\right )}}{\tan \left (f x + e\right )^{2} + 1} + 1\right ) + 2 \, {\left (b^{3} d f x + b^{3} c f\right )} \tan \left (f x + e\right )^{2} + 2 \, {\left (b^{3} d f + 2 \, {\left (a^{3} - 3 \, a b^{2}\right )} c f^{2}\right )} x + 2 \, {\left (3 \, a b^{2} d - {\left (3 \, a^{2} b - b^{3}\right )} d f x - {\left (3 \, a^{2} b - b^{3}\right )} c f\right )} \log \left (-\frac {2 \, {\left (i \, \tan \left (f x + e\right ) - 1\right )}}{\tan \left (f x + e\right )^{2} + 1}\right ) + 2 \, {\left (3 \, a b^{2} d - {\left (3 \, a^{2} b - b^{3}\right )} d f x - {\left (3 \, a^{2} b - b^{3}\right )} c f\right )} \log \left (-\frac {2 \, {\left (-i \, \tan \left (f x + e\right ) - 1\right )}}{\tan \left (f x + e\right )^{2} + 1}\right ) + 2 \, {\left (6 \, a b^{2} d f x + 6 \, a b^{2} c f - b^{3} d\right )} \tan \left (f x + e\right )}{4 \, f^{2}} \] Input:

integrate((d*x+c)*(a+b*tan(f*x+e))^3,x, algorithm="fricas")
 

Output:

1/4*(2*(a^3 - 3*a*b^2)*d*f^2*x^2 - I*(3*a^2*b - b^3)*d*dilog(2*(I*tan(f*x 
+ e) - 1)/(tan(f*x + e)^2 + 1) + 1) + I*(3*a^2*b - b^3)*d*dilog(2*(-I*tan( 
f*x + e) - 1)/(tan(f*x + e)^2 + 1) + 1) + 2*(b^3*d*f*x + b^3*c*f)*tan(f*x 
+ e)^2 + 2*(b^3*d*f + 2*(a^3 - 3*a*b^2)*c*f^2)*x + 2*(3*a*b^2*d - (3*a^2*b 
 - b^3)*d*f*x - (3*a^2*b - b^3)*c*f)*log(-2*(I*tan(f*x + e) - 1)/(tan(f*x 
+ e)^2 + 1)) + 2*(3*a*b^2*d - (3*a^2*b - b^3)*d*f*x - (3*a^2*b - b^3)*c*f) 
*log(-2*(-I*tan(f*x + e) - 1)/(tan(f*x + e)^2 + 1)) + 2*(6*a*b^2*d*f*x + 6 
*a*b^2*c*f - b^3*d)*tan(f*x + e))/f^2
 

Sympy [F]

\[ \int (c+d x) (a+b \tan (e+f x))^3 \, dx=\int \left (a + b \tan {\left (e + f x \right )}\right )^{3} \left (c + d x\right )\, dx \] Input:

integrate((d*x+c)*(a+b*tan(f*x+e))**3,x)
 

Output:

Integral((a + b*tan(e + f*x))**3*(c + d*x), x)
 

Maxima [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 1319 vs. \(2 (239) = 478\).

Time = 0.43 (sec) , antiderivative size = 1319, normalized size of antiderivative = 4.80 \[ \int (c+d x) (a+b \tan (e+f x))^3 \, dx=\text {Too large to display} \] Input:

integrate((d*x+c)*(a+b*tan(f*x+e))^3,x, algorithm="maxima")
 

Output:

1/2*(2*(f*x + e)*a^3*c + (f*x + e)^2*a^3*d/f - 2*(f*x + e)*a^3*d*e/f + 6*a 
^2*b*c*log(sec(f*x + e)) - 6*a^2*b*d*e*log(sec(f*x + e))/f - 2*(12*a*b^2*d 
*e - 12*a*b^2*c*f - (3*a^2*b + 3*I*a*b^2 - b^3)*(f*x + e)^2*d + 2*b^3*d + 
2*((3*I*a*b^2 - b^3)*d*e + (-3*I*a*b^2 + b^3)*c*f)*(f*x + e) + 2*(b^3*d*e 
- b^3*c*f - 3*a*b^2*d + (3*a^2*b - b^3)*(f*x + e)*d + (b^3*d*e - b^3*c*f - 
 3*a*b^2*d + (3*a^2*b - b^3)*(f*x + e)*d)*cos(4*f*x + 4*e) + 2*(b^3*d*e - 
b^3*c*f - 3*a*b^2*d + (3*a^2*b - b^3)*(f*x + e)*d)*cos(2*f*x + 2*e) + (I*b 
^3*d*e - I*b^3*c*f - 3*I*a*b^2*d + (3*I*a^2*b - I*b^3)*(f*x + e)*d)*sin(4* 
f*x + 4*e) + 2*(I*b^3*d*e - I*b^3*c*f - 3*I*a*b^2*d + (3*I*a^2*b - I*b^3)* 
(f*x + e)*d)*sin(2*f*x + 2*e))*arctan2(sin(2*f*x + 2*e), cos(2*f*x + 2*e) 
+ 1) - ((3*a^2*b + 3*I*a*b^2 - b^3)*(f*x + e)^2*d - 2*(6*a*b^2*d + (3*I*a* 
b^2 - b^3)*d*e + (-3*I*a*b^2 + b^3)*c*f)*(f*x + e))*cos(4*f*x + 4*e) - 2*( 
(3*a^2*b + 3*I*a*b^2 - b^3)*(f*x + e)^2*d - b^3*d - 2*(3*a*b^2 - I*b^3)*d* 
e + 2*(3*a*b^2 - I*b^3)*c*f - 2*((3*I*a*b^2 - b^3)*d*e + (-3*I*a*b^2 + b^3 
)*c*f + (3*a*b^2 + I*b^3)*d)*(f*x + e))*cos(2*f*x + 2*e) - ((3*a^2*b - b^3 
)*d*cos(4*f*x + 4*e) + 2*(3*a^2*b - b^3)*d*cos(2*f*x + 2*e) + (3*I*a^2*b - 
 I*b^3)*d*sin(4*f*x + 4*e) - 2*(-3*I*a^2*b + I*b^3)*d*sin(2*f*x + 2*e) + ( 
3*a^2*b - b^3)*d)*dilog(-e^(2*I*f*x + 2*I*e)) - (I*b^3*d*e - I*b^3*c*f - 3 
*I*a*b^2*d + (3*I*a^2*b - I*b^3)*(f*x + e)*d + (I*b^3*d*e - I*b^3*c*f - 3* 
I*a*b^2*d + (3*I*a^2*b - I*b^3)*(f*x + e)*d)*cos(4*f*x + 4*e) - 2*(-I*b...
 

Giac [F]

\[ \int (c+d x) (a+b \tan (e+f x))^3 \, dx=\int { {\left (d x + c\right )} {\left (b \tan \left (f x + e\right ) + a\right )}^{3} \,d x } \] Input:

integrate((d*x+c)*(a+b*tan(f*x+e))^3,x, algorithm="giac")
 

Output:

integrate((d*x + c)*(b*tan(f*x + e) + a)^3, x)
 

Mupad [F(-1)]

Timed out. \[ \int (c+d x) (a+b \tan (e+f x))^3 \, dx=\int {\left (a+b\,\mathrm {tan}\left (e+f\,x\right )\right )}^3\,\left (c+d\,x\right ) \,d x \] Input:

int((a + b*tan(e + f*x))^3*(c + d*x),x)
 

Output:

int((a + b*tan(e + f*x))^3*(c + d*x), x)
 

Reduce [F]

\[ \int (c+d x) (a+b \tan (e+f x))^3 \, dx=\frac {2 \left (\int \tan \left (f x +e \right )^{3} x d x \right ) b^{3} d \,f^{2}+6 \left (\int \tan \left (f x +e \right ) x d x \right ) a^{2} b d \,f^{2}+3 \,\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) a^{2} b c f -3 \,\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) a \,b^{2} d -\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) b^{3} c f +\tan \left (f x +e \right )^{2} b^{3} c f +6 \tan \left (f x +e \right ) a \,b^{2} c f +6 \tan \left (f x +e \right ) a \,b^{2} d f x +2 a^{3} c \,f^{2} x +a^{3} d \,f^{2} x^{2}-6 a \,b^{2} c \,f^{2} x -3 a \,b^{2} d \,f^{2} x^{2}}{2 f^{2}} \] Input:

int((d*x+c)*(a+b*tan(f*x+e))^3,x)
 

Output:

(2*int(tan(e + f*x)**3*x,x)*b**3*d*f**2 + 6*int(tan(e + f*x)*x,x)*a**2*b*d 
*f**2 + 3*log(tan(e + f*x)**2 + 1)*a**2*b*c*f - 3*log(tan(e + f*x)**2 + 1) 
*a*b**2*d - log(tan(e + f*x)**2 + 1)*b**3*c*f + tan(e + f*x)**2*b**3*c*f + 
 6*tan(e + f*x)*a*b**2*c*f + 6*tan(e + f*x)*a*b**2*d*f*x + 2*a**3*c*f**2*x 
 + a**3*d*f**2*x**2 - 6*a*b**2*c*f**2*x - 3*a*b**2*d*f**2*x**2)/(2*f**2)