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

Optimal. Leaf size=104 \[ -\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 \text {Li}_2\left (-e^{2 i x}\right )-2 \text {Li}_3\left (-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) \]

[Out]

-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

________________________________________________________________________________________

Rubi [A]
time = 0.14, antiderivative size = 104, normalized size of antiderivative = 1.00, number of steps used = 17, number of rules used = 8, integrand size = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 1.000, Rules used = {3801, 3556, 30, 3800, 2221, 2611, 2320, 6724} \begin {gather*} 4 i x \text {Li}_2\left (-e^{2 i x}\right )-2 \text {Li}_3\left (-e^{2 i x}\right )+\frac {x^4}{4}+\frac {4 i x^3}{3}+\frac {1}{3} x^3 \tan ^3(x)-x^3 \tan (x)-\frac {x^2}{2}-4 x^2 \log \left (1+e^{2 i x}\right )-\frac {1}{2} x^2 \tan ^2(x)+x \tan (x)+\log (\cos (x)) \end {gather*}

Antiderivative was successfully verified.

[In]

Int[x^3*Tan[x]^4,x]

[Out]

-1/2*x^2 + ((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*Tan[x] - x^3*Tan[x] - (x^2*Tan[x]^2)/2 + (x^3*Tan[x]^3)/3

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rule 2221

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]
 - Dist[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 2320

Int[u_, x_Symbol] :> With[{v = FunctionOfExponential[u, x]}, Dist[v/D[v, x], Subst[Int[FunctionOfExponentialFu
nction[u, x]/x, x], x, v], x]] /; FunctionOfExponentialQ[u, x] &&  !MatchQ[u, (w_)*((a_.)*(v_)^(n_))^(m_) /; F
reeQ[{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 2611

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] + Dist[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 3556

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

Rule 3800

Int[((c_.) + (d_.)*(x_))^(m_.)*tan[(e_.) + (f_.)*(x_)], x_Symbol] :> Simp[I*((c + d*x)^(m + 1)/(d*(m + 1))), x
] - Dist[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] &&
 IGtQ[m, 0]

Rule 3801

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

Rule 6724

Int[PolyLog[n_, (c_.)*((a_.) + (b_.)*(x_))^(p_.)]/((d_.) + (e_.)*(x_)), x_Symbol] :> 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]

Rubi steps

\begin {align*} \int x^3 \tan ^4(x) \, dx &=\frac {1}{3} x^3 \tan ^3(x)-\int x^3 \tan ^2(x) \, dx-\int x^2 \tan ^3(x) \, dx\\ &=-x^3 \tan (x)-\frac {1}{2} x^2 \tan ^2(x)+\frac {1}{3} x^3 \tan ^3(x)+3 \int x^2 \tan (x) \, dx+\int x^3 \, dx+\int x^2 \tan (x) \, dx+\int x \tan ^2(x) \, dx\\ &=\frac {4 i x^3}{3}+\frac {x^4}{4}+x \tan (x)-x^3 \tan (x)-\frac {1}{2} x^2 \tan ^2(x)+\frac {1}{3} x^3 \tan ^3(x)-2 i \int \frac {e^{2 i x} x^2}{1+e^{2 i x}} \, dx-6 i \int \frac {e^{2 i x} x^2}{1+e^{2 i x}} \, dx-\int x \, dx-\int \tan (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))+x \tan (x)-x^3 \tan (x)-\frac {1}{2} x^2 \tan ^2(x)+\frac {1}{3} x^3 \tan ^3(x)+2 \int x \log \left (1+e^{2 i x}\right ) \, dx+6 \int x \log \left (1+e^{2 i x}\right ) \, 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 \text {Li}_2\left (-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)-i \int \text {Li}_2\left (-e^{2 i x}\right ) \, dx-3 i \int \text {Li}_2\left (-e^{2 i x}\right ) \, 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 \text {Li}_2\left (-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)-\frac {1}{2} \text {Subst}\left (\int \frac {\text {Li}_2(-x)}{x} \, dx,x,e^{2 i x}\right )-\frac {3}{2} \text {Subst}\left (\int \frac {\text {Li}_2(-x)}{x} \, dx,x,e^{2 i x}\right )\\ &=-\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 \text {Li}_2\left (-e^{2 i x}\right )-2 \text {Li}_3\left (-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)\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.11, size = 101, normalized size = 0.97 \begin {gather*} \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 \text {Li}_2\left (-e^{2 i x}\right )-2 \text {Li}_3\left (-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) \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[x^3*Tan[x]^4,x]

[Out]

((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*PolyLo
g[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

________________________________________________________________________________________

Mathics [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {cought exception: maximum recursion depth exceeded while calling a Python object} \end {gather*}

Warning: Unable to verify antiderivative.

[In]

mathics('Integrate[x^3*Tan[x]^4,x]')

[Out]

cought exception: maximum recursion depth exceeded while calling a Python object

________________________________________________________________________________________

Maple [A]
time = 0.05, size = 138, normalized size = 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}}-2 \ln \left ({\mathrm e}^{i x}\right )+\ln \left ({\mathrm e}^{2 i x}+1\right )+\frac {8 i x^{3}}{3}-4 x^{2} \ln \left ({\mathrm e}^{2 i x}+1\right )+4 i x \polylog \left (2, -{\mathrm e}^{2 i x}\right )-2 \polylog \left (3, -{\mathrm e}^{2 i x}\right )\) \(138\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x^3*tan(x)^4,x,method=_RETURNVERBOSE)

[Out]

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-2*ln(exp(I*x))+ln(exp(2*I*x)+1)+8/3*I*x^3-4*x^2*ln(exp(2*I*x)+1)+4*I*x*polylog(2,-e
xp(2*I*x))-2*polylog(3,-exp(2*I*x))

________________________________________________________________________________________

Maxima [B] 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.40, size = 491, normalized size = 4.72 \begin {gather*} -\frac {3 i \, x^{4} + 12 \, {\left (4 \, x^{2} + {\left (4 \, x^{2} - 1\right )} \cos \left (6 \, x\right ) + 3 \, {\left (4 \, x^{2} - 1\right )} \cos \left (4 \, x\right ) + 3 \, {\left (4 \, x^{2} - 1\right )} \cos \left (2 \, x\right ) - {\left (-4 i \, x^{2} + i\right )} \sin \left (6 \, x\right ) - 3 \, {\left (-4 i \, x^{2} + i\right )} \sin \left (4 \, x\right ) - 3 \, {\left (-4 i \, x^{2} + i\right )} \sin \left (2 \, x\right ) - 1\right )} \arctan \left (\sin \left (2 \, x\right ), \cos \left (2 \, x\right ) + 1\right ) + {\left (3 i \, x^{4} - 32 \, x^{3} + 24 \, x\right )} \cos \left (6 \, x\right ) - 3 \, {\left (-3 i \, x^{4} + 16 \, x^{3} + 8 i \, x^{2} - 16 \, x\right )} \cos \left (4 \, x\right ) - 3 \, {\left (-3 i \, x^{4} + 16 \, x^{3} + 8 i \, x^{2} - 8 \, x\right )} \cos \left (2 \, x\right ) - 48 \, {\left (x \cos \left (6 \, x\right ) + 3 \, x \cos \left (4 \, x\right ) + 3 \, x \cos \left (2 \, x\right ) + i \, x \sin \left (6 \, x\right ) + 3 i \, x \sin \left (4 \, x\right ) + 3 i \, x \sin \left (2 \, x\right ) + x\right )} {\rm Li}_2\left (-e^{\left (2 i \, x\right )}\right ) - 6 \, {\left (4 i \, x^{2} + {\left (4 i \, x^{2} - i\right )} \cos \left (6 \, x\right ) + 3 \, {\left (4 i \, x^{2} - i\right )} \cos \left (4 \, x\right ) + 3 \, {\left (4 i \, x^{2} - i\right )} \cos \left (2 \, x\right ) - {\left (4 \, x^{2} - 1\right )} \sin \left (6 \, x\right ) - 3 \, {\left (4 \, x^{2} - 1\right )} \sin \left (4 \, x\right ) - 3 \, {\left (4 \, x^{2} - 1\right )} \sin \left (2 \, x\right ) - i\right )} \log \left (\cos \left (2 \, x\right )^{2} + \sin \left (2 \, x\right )^{2} + 2 \, \cos \left (2 \, x\right ) + 1\right ) - 24 \, {\left (i \, \cos \left (6 \, x\right ) + 3 i \, \cos \left (4 \, x\right ) + 3 i \, \cos \left (2 \, x\right ) - \sin \left (6 \, x\right ) - 3 \, \sin \left (4 \, x\right ) - 3 \, \sin \left (2 \, x\right ) + i\right )} {\rm Li}_{3}(-e^{\left (2 i \, x\right )}) - {\left (3 \, x^{4} + 32 i \, x^{3} - 24 i \, x\right )} \sin \left (6 \, x\right ) - 3 \, {\left (3 \, x^{4} + 16 i \, x^{3} - 8 \, x^{2} - 16 i \, x\right )} \sin \left (4 \, x\right ) - 3 \, {\left (3 \, x^{4} + 16 i \, x^{3} - 8 \, x^{2} - 8 i \, x\right )} \sin \left (2 \, x\right )}{-12 i \, \cos \left (6 \, x\right ) - 36 i \, \cos \left (4 \, x\right ) - 36 i \, \cos \left (2 \, x\right ) + 12 \, \sin \left (6 \, x\right ) + 36 \, \sin \left (4 \, x\right ) + 36 \, \sin \left (2 \, x\right ) - 12 i} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x^3*tan(x)^4,x, algorithm="maxima")

[Out]

-(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)

________________________________________________________________________________________

Fricas [C] Result contains higher order function than in optimal. Order 9 vs. order 4.
time = 0.32, size = 182, normalized size = 1.75 \begin {gather*} \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 ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x^3*tan(x)^4,x, algorithm="fricas")

[Out]

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) - polylog(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))

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int x^{3} \tan ^{4}{\left (x \right )}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x**3*tan(x)**4,x)

[Out]

Integral(x**3*tan(x)**4, x)

________________________________________________________________________________________

Giac [F] N/A
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x^3*tan(x)^4,x)

[Out]

Could not integrate

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int x^3\,{\mathrm {tan}\left (x\right )}^4 \,d x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x^3*tan(x)^4,x)

[Out]

int(x^3*tan(x)^4, x)

________________________________________________________________________________________