3.2.28 \(\int x^3 \tan ^4(x) \, dx\) [128]

3.2.28.1 Optimal result
3.2.28.2 Mathematica [A] (verified)
3.2.28.3 Rubi [A] (verified)
3.2.28.4 Maple [A] (verified)
3.2.28.5 Fricas [B] (verification not implemented)
3.2.28.6 Sympy [F]
3.2.28.7 Maxima [B] (verification not implemented)
3.2.28.8 Giac [F]
3.2.28.9 Mupad [F(-1)]
3.2.28.10 Reduce [F]

3.2.28.1 Optimal result

Integrand size = 8, antiderivative size = 104 \[ \int x^3 \tan ^4(x) \, dx=-\frac {x^2}{2}+\frac {4 i x^3}{3}+\frac {x^4}{4}-4 x^2 \log \left (1+e^{2 i x}\right )+\log (\cos (x))+4 i x \operatorname {PolyLog}\left (2,-e^{2 i x}\right )-2 \operatorname {PolyLog}\left (3,-e^{2 i x}\right )+x \tan (x)-x^3 \tan (x)-\frac {1}{2} x^2 \tan ^2(x)+\frac {1}{3} x^3 \tan ^3(x) \]

output
-1/2*x^2+4/3*I*x^3+1/4*x^4-4*x^2*ln(1+exp(2*I*x))+ln(cos(x))+4*I*x*polylog 
(2,-exp(2*I*x))-2*polylog(3,-exp(2*I*x))+x*tan(x)-x^3*tan(x)-1/2*x^2*tan(x 
)^2+1/3*x^3*tan(x)^3
 
3.2.28.2 Mathematica [A] (verified)

Time = 0.11 (sec) , antiderivative size = 101, normalized size of antiderivative = 0.97 \[ \int x^3 \tan ^4(x) \, dx=\frac {4 i x^3}{3}+\frac {x^4}{4}-4 x^2 \log \left (1+e^{2 i x}\right )+\log (\cos (x))+4 i x \operatorname {PolyLog}\left (2,-e^{2 i x}\right )-2 \operatorname {PolyLog}\left (3,-e^{2 i x}\right )-\frac {1}{2} x^2 \sec ^2(x)+x \tan (x)-\frac {4}{3} x^3 \tan (x)+\frac {1}{3} x^3 \sec ^2(x) \tan (x) \]

input
Integrate[x^3*Tan[x]^4,x]
 
output
((4*I)/3)*x^3 + x^4/4 - 4*x^2*Log[1 + E^((2*I)*x)] + Log[Cos[x]] + (4*I)*x 
*PolyLog[2, -E^((2*I)*x)] - 2*PolyLog[3, -E^((2*I)*x)] - (x^2*Sec[x]^2)/2 
+ x*Tan[x] - (4*x^3*Tan[x])/3 + (x^3*Sec[x]^2*Tan[x])/3
 
3.2.28.3 Rubi [A] (verified)

Time = 0.76 (sec) , antiderivative size = 125, normalized size of antiderivative = 1.20, number of steps used = 16, number of rules used = 15, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 1.875, Rules used = {3042, 4203, 3042, 4203, 15, 3042, 4202, 2620, 3011, 2720, 4203, 15, 3042, 3956, 7143}

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 x^3 \tan ^4(x) \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int x^3 \tan (x)^4dx\)

\(\Big \downarrow \) 4203

\(\displaystyle -\int x^3 \tan ^2(x)dx-\int x^2 \tan ^3(x)dx+\frac {1}{3} x^3 \tan ^3(x)\)

\(\Big \downarrow \) 3042

\(\displaystyle -\int x^3 \tan (x)^2dx-\int x^2 \tan (x)^3dx+\frac {1}{3} x^3 \tan ^3(x)\)

\(\Big \downarrow \) 4203

\(\displaystyle \int x^3dx+4 \int x^2 \tan (x)dx+\int x \tan ^2(x)dx+\frac {1}{3} x^3 \tan ^3(x)-x^3 \tan (x)-\frac {1}{2} x^2 \tan ^2(x)\)

\(\Big \downarrow \) 15

\(\displaystyle 4 \int x^2 \tan (x)dx+\int x \tan ^2(x)dx+\frac {x^4}{4}+\frac {1}{3} x^3 \tan ^3(x)-x^3 \tan (x)-\frac {1}{2} x^2 \tan ^2(x)\)

\(\Big \downarrow \) 3042

\(\displaystyle 4 \int x^2 \tan (x)dx+\int x \tan (x)^2dx+\frac {x^4}{4}+\frac {1}{3} x^3 \tan ^3(x)-x^3 \tan (x)-\frac {1}{2} x^2 \tan ^2(x)\)

\(\Big \downarrow \) 4202

\(\displaystyle 4 \left (\frac {i x^3}{3}-2 i \int \frac {e^{2 i x} x^2}{1+e^{2 i x}}dx\right )+\int x \tan (x)^2dx+\frac {x^4}{4}+\frac {1}{3} x^3 \tan ^3(x)-x^3 \tan (x)-\frac {1}{2} x^2 \tan ^2(x)\)

\(\Big \downarrow \) 2620

\(\displaystyle 4 \left (\frac {i x^3}{3}-2 i \left (i \int x \log \left (1+e^{2 i x}\right )dx-\frac {1}{2} i x^2 \log \left (1+e^{2 i x}\right )\right )\right )+\int x \tan (x)^2dx+\frac {x^4}{4}+\frac {1}{3} x^3 \tan ^3(x)-x^3 \tan (x)-\frac {1}{2} x^2 \tan ^2(x)\)

\(\Big \downarrow \) 3011

\(\displaystyle 4 \left (\frac {i x^3}{3}-2 i \left (i \left (\frac {1}{2} i x \operatorname {PolyLog}\left (2,-e^{2 i x}\right )-\frac {1}{2} i \int \operatorname {PolyLog}\left (2,-e^{2 i x}\right )dx\right )-\frac {1}{2} i x^2 \log \left (1+e^{2 i x}\right )\right )\right )+\int x \tan (x)^2dx+\frac {x^4}{4}+\frac {1}{3} x^3 \tan ^3(x)-x^3 \tan (x)-\frac {1}{2} x^2 \tan ^2(x)\)

\(\Big \downarrow \) 2720

\(\displaystyle 4 \left (\frac {i x^3}{3}-2 i \left (i \left (\frac {1}{2} i x \operatorname {PolyLog}\left (2,-e^{2 i x}\right )-\frac {1}{4} \int e^{-2 i x} \operatorname {PolyLog}\left (2,-e^{2 i x}\right )de^{2 i x}\right )-\frac {1}{2} i x^2 \log \left (1+e^{2 i x}\right )\right )\right )+\int x \tan (x)^2dx+\frac {x^4}{4}+\frac {1}{3} x^3 \tan ^3(x)-x^3 \tan (x)-\frac {1}{2} x^2 \tan ^2(x)\)

\(\Big \downarrow \) 4203

\(\displaystyle 4 \left (\frac {i x^3}{3}-2 i \left (i \left (\frac {1}{2} i x \operatorname {PolyLog}\left (2,-e^{2 i x}\right )-\frac {1}{4} \int e^{-2 i x} \operatorname {PolyLog}\left (2,-e^{2 i x}\right )de^{2 i x}\right )-\frac {1}{2} i x^2 \log \left (1+e^{2 i x}\right )\right )\right )-\int xdx-\int \tan (x)dx+\frac {x^4}{4}+\frac {1}{3} x^3 \tan ^3(x)-x^3 \tan (x)-\frac {1}{2} x^2 \tan ^2(x)+x \tan (x)\)

\(\Big \downarrow \) 15

\(\displaystyle 4 \left (\frac {i x^3}{3}-2 i \left (i \left (\frac {1}{2} i x \operatorname {PolyLog}\left (2,-e^{2 i x}\right )-\frac {1}{4} \int e^{-2 i x} \operatorname {PolyLog}\left (2,-e^{2 i x}\right )de^{2 i x}\right )-\frac {1}{2} i x^2 \log \left (1+e^{2 i x}\right )\right )\right )-\int \tan (x)dx+\frac {x^4}{4}+\frac {1}{3} x^3 \tan ^3(x)-x^3 \tan (x)-\frac {x^2}{2}-\frac {1}{2} x^2 \tan ^2(x)+x \tan (x)\)

\(\Big \downarrow \) 3042

\(\displaystyle 4 \left (\frac {i x^3}{3}-2 i \left (i \left (\frac {1}{2} i x \operatorname {PolyLog}\left (2,-e^{2 i x}\right )-\frac {1}{4} \int e^{-2 i x} \operatorname {PolyLog}\left (2,-e^{2 i x}\right )de^{2 i x}\right )-\frac {1}{2} i x^2 \log \left (1+e^{2 i x}\right )\right )\right )-\int \tan (x)dx+\frac {x^4}{4}+\frac {1}{3} x^3 \tan ^3(x)-x^3 \tan (x)-\frac {x^2}{2}-\frac {1}{2} x^2 \tan ^2(x)+x \tan (x)\)

\(\Big \downarrow \) 3956

\(\displaystyle 4 \left (\frac {i x^3}{3}-2 i \left (i \left (\frac {1}{2} i x \operatorname {PolyLog}\left (2,-e^{2 i x}\right )-\frac {1}{4} \int e^{-2 i x} \operatorname {PolyLog}\left (2,-e^{2 i x}\right )de^{2 i x}\right )-\frac {1}{2} i x^2 \log \left (1+e^{2 i x}\right )\right )\right )+\frac {x^4}{4}+\frac {1}{3} x^3 \tan ^3(x)-x^3 \tan (x)-\frac {x^2}{2}-\frac {1}{2} x^2 \tan ^2(x)+x \tan (x)+\log (\cos (x))\)

\(\Big \downarrow \) 7143

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

input
Int[x^3*Tan[x]^4,x]
 
output
-1/2*x^2 + x^4/4 + Log[Cos[x]] + 4*((I/3)*x^3 - (2*I)*((-1/2*I)*x^2*Log[1 
+ E^((2*I)*x)] + I*((I/2)*x*PolyLog[2, -E^((2*I)*x)] - PolyLog[3, -E^((2*I 
)*x)]/4))) + x*Tan[x] - x^3*Tan[x] - (x^2*Tan[x]^2)/2 + (x^3*Tan[x]^3)/3
 

3.2.28.3.1 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 2620
Int[(((F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)*((c_.) + (d_.)*(x_))^(m_.))/ 
((a_) + (b_.)*((F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)), x_Symbol] :> Simp 
[((c + d*x)^m/(b*f*g*n*Log[F]))*Log[1 + b*((F^(g*(e + f*x)))^n/a)], x] - Si 
mp[d*(m/(b*f*g*n*Log[F]))   Int[(c + d*x)^(m - 1)*Log[1 + b*((F^(g*(e + f*x 
)))^n/a)], x], x] /; FreeQ[{F, a, b, c, d, e, f, g, n}, x] && IGtQ[m, 0]
 

rule 2720
Int[u_, x_Symbol] :> With[{v = FunctionOfExponential[u, x]}, Simp[v/D[v, x] 
   Subst[Int[FunctionOfExponentialFunction[u, x]/x, x], x, v], x]] /; Funct 
ionOfExponentialQ[u, x] &&  !MatchQ[u, (w_)*((a_.)*(v_)^(n_))^(m_) /; FreeQ 
[{a, m, n}, x] && IntegerQ[m*n]] &&  !MatchQ[u, E^((c_.)*((a_.) + (b_.)*x)) 
*(F_)[v_] /; FreeQ[{a, b, c}, x] && InverseFunctionQ[F[x]]]
 

rule 3011
Int[Log[1 + (e_.)*((F_)^((c_.)*((a_.) + (b_.)*(x_))))^(n_.)]*((f_.) + (g_.) 
*(x_))^(m_.), x_Symbol] :> Simp[(-(f + g*x)^m)*(PolyLog[2, (-e)*(F^(c*(a + 
b*x)))^n]/(b*c*n*Log[F])), x] + Simp[g*(m/(b*c*n*Log[F]))   Int[(f + g*x)^( 
m - 1)*PolyLog[2, (-e)*(F^(c*(a + b*x)))^n], x], x] /; FreeQ[{F, a, b, c, e 
, f, g, n}, x] && GtQ[m, 0]
 

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 4202
Int[((c_.) + (d_.)*(x_))^(m_.)*tan[(e_.) + (f_.)*(x_)], x_Symbol] :> Simp[I 
*((c + d*x)^(m + 1)/(d*(m + 1))), x] - Simp[2*I   Int[(c + d*x)^m*(E^(2*I*( 
e + f*x))/(1 + E^(2*I*(e + f*x)))), x], x] /; FreeQ[{c, d, e, f}, x] && IGt 
Q[m, 0]
 

rule 4203
Int[((c_.) + (d_.)*(x_))^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symb 
ol] :> Simp[b*(c + d*x)^m*((b*Tan[e + f*x])^(n - 1)/(f*(n - 1))), x] + (-Si 
mp[b*d*(m/(f*(n - 1)))   Int[(c + d*x)^(m - 1)*(b*Tan[e + f*x])^(n - 1), x] 
, x] - Simp[b^2   Int[(c + d*x)^m*(b*Tan[e + f*x])^(n - 2), x], x]) /; Free 
Q[{b, c, d, e, f}, x] && GtQ[n, 1] && GtQ[m, 0]
 

rule 7143
Int[PolyLog[n_, (c_.)*((a_.) + (b_.)*(x_))^(p_.)]/((d_.) + (e_.)*(x_)), x_S 
ymbol] :> Simp[PolyLog[n + 1, c*(a + b*x)^p]/(e*p), x] /; FreeQ[{a, b, c, d 
, e, n, p}, x] && EqQ[b*d, a*e]
 
3.2.28.4 Maple [A] (verified)

Time = 0.14 (sec) , antiderivative size = 138, normalized size of antiderivative = 1.33

method result size
risch \(\frac {x^{4}}{4}-\frac {2 i x \left (6 x^{2} {\mathrm e}^{4 i x}+6 x^{2} {\mathrm e}^{2 i x}-3 \,{\mathrm e}^{4 i x}-3 i x \,{\mathrm e}^{4 i x}+4 x^{2}-6 \,{\mathrm e}^{2 i x}-3 i x \,{\mathrm e}^{2 i x}-3\right )}{3 \left ({\mathrm e}^{2 i x}+1\right )^{3}}+\ln \left ({\mathrm e}^{2 i x}+1\right )-2 \ln \left ({\mathrm e}^{i x}\right )+\frac {8 i x^{3}}{3}-4 x^{2} \ln \left ({\mathrm e}^{2 i x}+1\right )+4 i x \,\operatorname {Li}_{2}\left (-{\mathrm e}^{2 i x}\right )-2 \,\operatorname {Li}_{3}\left (-{\mathrm e}^{2 i x}\right )\) \(138\)

input
int(x^3*tan(x)^4,x,method=_RETURNVERBOSE)
 
output
1/4*x^4-2/3*I*x*(6*x^2*exp(4*I*x)+6*x^2*exp(2*I*x)-3*exp(4*I*x)-3*I*x*exp( 
4*I*x)+4*x^2-6*exp(2*I*x)-3*I*x*exp(2*I*x)-3)/(exp(2*I*x)+1)^3+ln(exp(2*I* 
x)+1)-2*ln(exp(I*x))+8/3*I*x^3-4*x^2*ln(exp(2*I*x)+1)+4*I*x*polylog(2,-exp 
(2*I*x))-2*polylog(3,-exp(2*I*x))
 
3.2.28.5 Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 182 vs. \(2 (80) = 160\).

Time = 0.28 (sec) , antiderivative size = 182, normalized size of antiderivative = 1.75 \[ \int x^3 \tan ^4(x) \, dx=\frac {1}{3} \, x^{3} \tan \left (x\right )^{3} + \frac {1}{4} \, x^{4} - \frac {1}{2} \, x^{2} \tan \left (x\right )^{2} - \frac {1}{2} \, x^{2} - 2 i \, x {\rm Li}_2\left (\frac {2 \, {\left (i \, \tan \left (x\right ) - 1\right )}}{\tan \left (x\right )^{2} + 1} + 1\right ) + 2 i \, x {\rm Li}_2\left (\frac {2 \, {\left (-i \, \tan \left (x\right ) - 1\right )}}{\tan \left (x\right )^{2} + 1} + 1\right ) - \frac {1}{2} \, {\left (4 \, x^{2} - 1\right )} \log \left (-\frac {2 \, {\left (i \, \tan \left (x\right ) - 1\right )}}{\tan \left (x\right )^{2} + 1}\right ) - \frac {1}{2} \, {\left (4 \, x^{2} - 1\right )} \log \left (-\frac {2 \, {\left (-i \, \tan \left (x\right ) - 1\right )}}{\tan \left (x\right )^{2} + 1}\right ) - {\left (x^{3} - x\right )} \tan \left (x\right ) - {\rm polylog}\left (3, \frac {\tan \left (x\right )^{2} + 2 i \, \tan \left (x\right ) - 1}{\tan \left (x\right )^{2} + 1}\right ) - {\rm polylog}\left (3, \frac {\tan \left (x\right )^{2} - 2 i \, \tan \left (x\right ) - 1}{\tan \left (x\right )^{2} + 1}\right ) \]

input
integrate(x^3*tan(x)^4,x, algorithm="fricas")
 
output
1/3*x^3*tan(x)^3 + 1/4*x^4 - 1/2*x^2*tan(x)^2 - 1/2*x^2 - 2*I*x*dilog(2*(I 
*tan(x) - 1)/(tan(x)^2 + 1) + 1) + 2*I*x*dilog(2*(-I*tan(x) - 1)/(tan(x)^2 
 + 1) + 1) - 1/2*(4*x^2 - 1)*log(-2*(I*tan(x) - 1)/(tan(x)^2 + 1)) - 1/2*( 
4*x^2 - 1)*log(-2*(-I*tan(x) - 1)/(tan(x)^2 + 1)) - (x^3 - x)*tan(x) - pol 
ylog(3, (tan(x)^2 + 2*I*tan(x) - 1)/(tan(x)^2 + 1)) - polylog(3, (tan(x)^2 
 - 2*I*tan(x) - 1)/(tan(x)^2 + 1))
 
3.2.28.6 Sympy [F]

\[ \int x^3 \tan ^4(x) \, dx=\int x^{3} \tan ^{4}{\left (x \right )}\, dx \]

input
integrate(x**3*tan(x)**4,x)
 
output
Integral(x**3*tan(x)**4, x)
 
3.2.28.7 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. 491 vs. \(2 (80) = 160\).

Time = 0.32 (sec) , antiderivative size = 491, normalized size of antiderivative = 4.72 \[ \int x^3 \tan ^4(x) \, dx =\text {Too large to display} \]

input
integrate(x^3*tan(x)^4,x, algorithm="maxima")
 
output
-(3*I*x^4 + 12*(4*x^2 + (4*x^2 - 1)*cos(6*x) + 3*(4*x^2 - 1)*cos(4*x) + 3* 
(4*x^2 - 1)*cos(2*x) - (-4*I*x^2 + I)*sin(6*x) - 3*(-4*I*x^2 + I)*sin(4*x) 
 - 3*(-4*I*x^2 + I)*sin(2*x) - 1)*arctan2(sin(2*x), cos(2*x) + 1) + (3*I*x 
^4 - 32*x^3 + 24*x)*cos(6*x) - 3*(-3*I*x^4 + 16*x^3 + 8*I*x^2 - 16*x)*cos( 
4*x) - 3*(-3*I*x^4 + 16*x^3 + 8*I*x^2 - 8*x)*cos(2*x) - 48*(x*cos(6*x) + 3 
*x*cos(4*x) + 3*x*cos(2*x) + I*x*sin(6*x) + 3*I*x*sin(4*x) + 3*I*x*sin(2*x 
) + x)*dilog(-e^(2*I*x)) - 6*(4*I*x^2 + (4*I*x^2 - I)*cos(6*x) + 3*(4*I*x^ 
2 - I)*cos(4*x) + 3*(4*I*x^2 - I)*cos(2*x) - (4*x^2 - 1)*sin(6*x) - 3*(4*x 
^2 - 1)*sin(4*x) - 3*(4*x^2 - 1)*sin(2*x) - I)*log(cos(2*x)^2 + sin(2*x)^2 
 + 2*cos(2*x) + 1) - 24*(I*cos(6*x) + 3*I*cos(4*x) + 3*I*cos(2*x) - sin(6* 
x) - 3*sin(4*x) - 3*sin(2*x) + I)*polylog(3, -e^(2*I*x)) - (3*x^4 + 32*I*x 
^3 - 24*I*x)*sin(6*x) - 3*(3*x^4 + 16*I*x^3 - 8*x^2 - 16*I*x)*sin(4*x) - 3 
*(3*x^4 + 16*I*x^3 - 8*x^2 - 8*I*x)*sin(2*x))/(-12*I*cos(6*x) - 36*I*cos(4 
*x) - 36*I*cos(2*x) + 12*sin(6*x) + 36*sin(4*x) + 36*sin(2*x) - 12*I)
 
3.2.28.8 Giac [F]

\[ \int x^3 \tan ^4(x) \, dx=\int { x^{3} \tan \left (x\right )^{4} \,d x } \]

input
integrate(x^3*tan(x)^4,x, algorithm="giac")
 
output
integrate(x^3*tan(x)^4, x)
 
3.2.28.9 Mupad [F(-1)]

Timed out. \[ \int x^3 \tan ^4(x) \, dx=\int x^3\,{\mathrm {tan}\left (x\right )}^4 \,d x \]

input
int(x^3*tan(x)^4,x)
 
output
int(x^3*tan(x)^4, x)
 
3.2.28.10 Reduce [F]

\[ \int x^3 \tan ^4(x) \, dx=4 \left (\int \tan \left (x \right ) x^{2}d x \right )-\frac {\mathrm {log}\left (\tan \left (x \right )^{2}+1\right )}{2}+\frac {\tan \left (x \right )^{3} x^{3}}{3}-\frac {\tan \left (x \right )^{2} x^{2}}{2}-\tan \left (x \right ) x^{3}+\tan \left (x \right ) x +\frac {x^{4}}{4}-\frac {x^{2}}{2} \]

input
int(tan(x)**4*x**3,x)
 
output
(48*int(tan(x)*x**2,x) - 6*log(tan(x)**2 + 1) + 4*tan(x)**3*x**3 - 6*tan(x 
)**2*x**2 - 12*tan(x)*x**3 + 12*tan(x)*x + 3*x**4 - 6*x**2)/12