3.341 \(\int (\sin (x)+\tan (x))^4 \, dx\)

Optimal. Leaf size=55 \[ -\frac{61 x}{8}-\frac{4 \sin ^3(x)}{3}+\frac{\tan ^3(x)}{3}+5 \tan (x)-2 \tanh ^{-1}(\sin (x))+\frac{1}{4} \sin (x) \cos ^3(x)+\frac{19}{8} \sin (x) \cos (x)+2 \tan (x) \sec (x) \]

[Out]

(-61*x)/8 - 2*ArcTanh[Sin[x]] + (19*Cos[x]*Sin[x])/8 + (Cos[x]^3*Sin[x])/4 - (4*Sin[x]^3)/3 + 5*Tan[x] + 2*Sec
[x]*Tan[x] + Tan[x]^3/3

________________________________________________________________________________________

Rubi [A]  time = 0.109614, antiderivative size = 55, normalized size of antiderivative = 1., number of steps used = 18, number of rules used = 9, integrand size = 7, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 1.286, Rules used = {4397, 2709, 2637, 2635, 8, 2633, 3770, 3767, 3768} \[ -\frac{61 x}{8}-\frac{4 \sin ^3(x)}{3}+\frac{\tan ^3(x)}{3}+5 \tan (x)-2 \tanh ^{-1}(\sin (x))+\frac{1}{4} \sin (x) \cos ^3(x)+\frac{19}{8} \sin (x) \cos (x)+2 \tan (x) \sec (x) \]

Antiderivative was successfully verified.

[In]

Int[(Sin[x] + Tan[x])^4,x]

[Out]

(-61*x)/8 - 2*ArcTanh[Sin[x]] + (19*Cos[x]*Sin[x])/8 + (Cos[x]^3*Sin[x])/4 - (4*Sin[x]^3)/3 + 5*Tan[x] + 2*Sec
[x]*Tan[x] + Tan[x]^3/3

Rule 4397

Int[u_, x_Symbol] :> Int[TrigSimplify[u], x] /; TrigSimplifyQ[u]

Rule 2709

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*tan[(e_.) + (f_.)*(x_)]^(p_), x_Symbol] :> Dist[a^p, Int[Expan
dIntegrand[(Sin[e + f*x]^p*(a + b*Sin[e + f*x])^(m - p/2))/(a - b*Sin[e + f*x])^(p/2), x], x], x] /; FreeQ[{a,
 b, e, f}, x] && EqQ[a^2 - b^2, 0] && IntegersQ[m, p/2] && (LtQ[p, 0] || GtQ[m - p/2, 0])

Rule 2637

Int[sin[Pi/2 + (c_.) + (d_.)*(x_)], x_Symbol] :> Simp[Sin[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 2635

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> -Simp[(b*Cos[c + d*x]*(b*Sin[c + d*x])^(n - 1))/(d*n),
x] + Dist[(b^2*(n - 1))/n, Int[(b*Sin[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && Integer
Q[2*n]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2633

Int[sin[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> -Dist[d^(-1), Subst[Int[Expand[(1 - x^2)^((n - 1)/2), x], x], x
, Cos[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[(n - 1)/2, 0]

Rule 3770

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

Rule 3767

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> -Dist[d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rule 3768

Int[(csc[(c_.) + (d_.)*(x_)]*(b_.))^(n_), x_Symbol] :> -Simp[(b*Cos[c + d*x]*(b*Csc[c + d*x])^(n - 1))/(d*(n -
 1)), x] + Dist[(b^2*(n - 2))/(n - 1), Int[(b*Csc[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1
] && IntegerQ[2*n]

Rubi steps

\begin{align*} \int (\sin (x)+\tan (x))^4 \, dx &=\int (1+\cos (x))^4 \tan ^4(x) \, dx\\ &=\int \left (-10-4 \cos (x)+4 \cos ^2(x)+4 \cos ^3(x)+\cos ^4(x)-4 \sec (x)+4 \sec ^2(x)+4 \sec ^3(x)+\sec ^4(x)\right ) \, dx\\ &=-10 x-4 \int \cos (x) \, dx+4 \int \cos ^2(x) \, dx+4 \int \cos ^3(x) \, dx-4 \int \sec (x) \, dx+4 \int \sec ^2(x) \, dx+4 \int \sec ^3(x) \, dx+\int \cos ^4(x) \, dx+\int \sec ^4(x) \, dx\\ &=-10 x-4 \tanh ^{-1}(\sin (x))-4 \sin (x)+2 \cos (x) \sin (x)+\frac{1}{4} \cos ^3(x) \sin (x)+2 \sec (x) \tan (x)+\frac{3}{4} \int \cos ^2(x) \, dx+2 \int 1 \, dx+2 \int \sec (x) \, dx-4 \operatorname{Subst}(\int 1 \, dx,x,-\tan (x))-4 \operatorname{Subst}\left (\int \left (1-x^2\right ) \, dx,x,-\sin (x)\right )-\operatorname{Subst}\left (\int \left (1+x^2\right ) \, dx,x,-\tan (x)\right )\\ &=-8 x-2 \tanh ^{-1}(\sin (x))+\frac{19}{8} \cos (x) \sin (x)+\frac{1}{4} \cos ^3(x) \sin (x)-\frac{4 \sin ^3(x)}{3}+5 \tan (x)+2 \sec (x) \tan (x)+\frac{\tan ^3(x)}{3}+\frac{3 \int 1 \, dx}{8}\\ &=-\frac{61 x}{8}-2 \tanh ^{-1}(\sin (x))+\frac{19}{8} \cos (x) \sin (x)+\frac{1}{4} \cos ^3(x) \sin (x)-\frac{4 \sin ^3(x)}{3}+5 \tan (x)+2 \sec (x) \tan (x)+\frac{\tan ^3(x)}{3}\\ \end{align*}

Mathematica [B]  time = 0.200432, size = 129, normalized size = 2.35 \[ \frac{1}{768} \sec ^3(x) \left (1395 \sin (x)+672 \sin (2 x)+1265 \sin (3 x)+129 \sin (5 x)+32 \sin (6 x)+3 \sin (7 x)-72 \cos (x) \left (61 x-16 \log \left (\cos \left (\frac{x}{2}\right )-\sin \left (\frac{x}{2}\right )\right )+16 \log \left (\sin \left (\frac{x}{2}\right )+\cos \left (\frac{x}{2}\right )\right )\right )-24 \cos (3 x) \left (61 x-16 \log \left (\cos \left (\frac{x}{2}\right )-\sin \left (\frac{x}{2}\right )\right )+16 \log \left (\sin \left (\frac{x}{2}\right )+\cos \left (\frac{x}{2}\right )\right )\right )\right ) \]

Antiderivative was successfully verified.

[In]

Integrate[(Sin[x] + Tan[x])^4,x]

[Out]

(Sec[x]^3*(-72*Cos[x]*(61*x - 16*Log[Cos[x/2] - Sin[x/2]] + 16*Log[Cos[x/2] + Sin[x/2]]) - 24*Cos[3*x]*(61*x -
 16*Log[Cos[x/2] - Sin[x/2]] + 16*Log[Cos[x/2] + Sin[x/2]]) + 1395*Sin[x] + 672*Sin[2*x] + 1265*Sin[3*x] + 129
*Sin[5*x] + 32*Sin[6*x] + 3*Sin[7*x]))/768

________________________________________________________________________________________

Maple [A]  time = 0.022, size = 66, normalized size = 1.2 \begin{align*}{\frac{23\,\cos \left ( x \right ) }{4} \left ( \left ( \sin \left ( x \right ) \right ) ^{3}+{\frac{3\,\sin \left ( x \right ) }{2}} \right ) }-{\frac{61\,x}{8}}+{\frac{2\, \left ( \sin \left ( x \right ) \right ) ^{3}}{3}}+2\,\sin \left ( x \right ) -2\,\ln \left ( \sec \left ( x \right ) +\tan \left ( x \right ) \right ) +6\,{\frac{ \left ( \sin \left ( x \right ) \right ) ^{5}}{\cos \left ( x \right ) }}+2\,{\frac{ \left ( \sin \left ( x \right ) \right ) ^{5}}{ \left ( \cos \left ( x \right ) \right ) ^{2}}}+{\frac{ \left ( \tan \left ( x \right ) \right ) ^{3}}{3}}-\tan \left ( x \right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((sin(x)+tan(x))^4,x)

[Out]

23/4*(sin(x)^3+3/2*sin(x))*cos(x)-61/8*x+2/3*sin(x)^3+2*sin(x)-2*ln(sec(x)+tan(x))+6*sin(x)^5/cos(x)+2*sin(x)^
5/cos(x)^2+1/3*tan(x)^3-tan(x)

________________________________________________________________________________________

Maxima [A]  time = 1.49245, size = 92, normalized size = 1.67 \begin{align*} -\frac{4}{3} \, \sin \left (x\right )^{3} + \frac{1}{3} \, \tan \left (x\right )^{3} - \frac{61}{8} \, x - \frac{2 \, \sin \left (x\right )}{\sin \left (x\right )^{2} - 1} + \frac{3 \, \tan \left (x\right )}{\tan \left (x\right )^{2} + 1} - \log \left (\sin \left (x\right ) + 1\right ) + \log \left (\sin \left (x\right ) - 1\right ) + \frac{1}{32} \, \sin \left (4 \, x\right ) - \frac{1}{4} \, \sin \left (2 \, x\right ) + 5 \, \tan \left (x\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((sin(x)+tan(x))^4,x, algorithm="maxima")

[Out]

-4/3*sin(x)^3 + 1/3*tan(x)^3 - 61/8*x - 2*sin(x)/(sin(x)^2 - 1) + 3*tan(x)/(tan(x)^2 + 1) - log(sin(x) + 1) +
log(sin(x) - 1) + 1/32*sin(4*x) - 1/4*sin(2*x) + 5*tan(x)

________________________________________________________________________________________

Fricas [A]  time = 2.2071, size = 255, normalized size = 4.64 \begin{align*} -\frac{183 \, x \cos \left (x\right )^{3} + 24 \, \cos \left (x\right )^{3} \log \left (\sin \left (x\right ) + 1\right ) - 24 \, \cos \left (x\right )^{3} \log \left (-\sin \left (x\right ) + 1\right ) -{\left (6 \, \cos \left (x\right )^{6} + 32 \, \cos \left (x\right )^{5} + 57 \, \cos \left (x\right )^{4} - 32 \, \cos \left (x\right )^{3} + 112 \, \cos \left (x\right )^{2} + 48 \, \cos \left (x\right ) + 8\right )} \sin \left (x\right )}{24 \, \cos \left (x\right )^{3}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((sin(x)+tan(x))^4,x, algorithm="fricas")

[Out]

-1/24*(183*x*cos(x)^3 + 24*cos(x)^3*log(sin(x) + 1) - 24*cos(x)^3*log(-sin(x) + 1) - (6*cos(x)^6 + 32*cos(x)^5
 + 57*cos(x)^4 - 32*cos(x)^3 + 112*cos(x)^2 + 48*cos(x) + 8)*sin(x))/cos(x)^3

________________________________________________________________________________________

Sympy [A]  time = 8.13968, size = 90, normalized size = 1.64 \begin{align*} - \frac{61 x}{8} + \log{\left (\sin{\left (x \right )} - 1 \right )} - \log{\left (\sin{\left (x \right )} + 1 \right )} - \frac{4 \sin ^{3}{\left (x \right )}}{3} + \frac{6 \sin ^{3}{\left (x \right )}}{\cos{\left (x \right )}} + \frac{\sin ^{3}{\left (x \right )}}{3 \cos ^{3}{\left (x \right )}} + 9 \sin{\left (x \right )} \cos{\left (x \right )} - \frac{\sin{\left (x \right )}}{\cos{\left (x \right )}} - \frac{\sin{\left (2 x \right )}}{4} + \frac{\sin{\left (4 x \right )}}{32} - \frac{4 \sin{\left (x \right )}}{2 \sin ^{2}{\left (x \right )} - 2} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((sin(x)+tan(x))**4,x)

[Out]

-61*x/8 + log(sin(x) - 1) - log(sin(x) + 1) - 4*sin(x)**3/3 + 6*sin(x)**3/cos(x) + sin(x)**3/(3*cos(x)**3) + 9
*sin(x)*cos(x) - sin(x)/cos(x) - sin(2*x)/4 + sin(4*x)/32 - 4*sin(x)/(2*sin(x)**2 - 2)

________________________________________________________________________________________

Giac [B]  time = 8.73601, size = 1856, normalized size = 33.75 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((sin(x)+tan(x))^4,x, algorithm="giac")

[Out]

1/24*(8*tan(1/2*x)^10*tan(x)^5 - 183*x*tan(1/2*x)^10*tan(x)^2 - 24*log(2*(tan(1/2*x)^2 + 2*tan(1/2*x) + 1)/(ta
n(1/2*x)^2 + 1))*tan(1/2*x)^10*tan(x)^2 + 24*log(2*(tan(1/2*x)^2 - 2*tan(1/2*x) + 1)/(tan(1/2*x)^2 + 1))*tan(1
/2*x)^10*tan(x)^2 + 128*tan(1/2*x)^10*tan(x)^3 + 8*tan(1/2*x)^8*tan(x)^5 - 183*x*tan(1/2*x)^10 - 24*log(2*(tan
(1/2*x)^2 + 2*tan(1/2*x) + 1)/(tan(1/2*x)^2 + 1))*tan(1/2*x)^10 + 24*log(2*(tan(1/2*x)^2 - 2*tan(1/2*x) + 1)/(
tan(1/2*x)^2 + 1))*tan(1/2*x)^10 + 180*tan(1/2*x)^10*tan(x) - 183*x*tan(1/2*x)^8*tan(x)^2 - 24*log(2*(tan(1/2*
x)^2 + 2*tan(1/2*x) + 1)/(tan(1/2*x)^2 + 1))*tan(1/2*x)^8*tan(x)^2 + 24*log(2*(tan(1/2*x)^2 - 2*tan(1/2*x) + 1
)/(tan(1/2*x)^2 + 1))*tan(1/2*x)^8*tan(x)^2 + 96*tan(1/2*x)^9*tan(x)^2 + 128*tan(1/2*x)^8*tan(x)^3 - 16*tan(1/
2*x)^6*tan(x)^5 - 183*x*tan(1/2*x)^8 - 24*log(2*(tan(1/2*x)^2 + 2*tan(1/2*x) + 1)/(tan(1/2*x)^2 + 1))*tan(1/2*
x)^8 + 24*log(2*(tan(1/2*x)^2 - 2*tan(1/2*x) + 1)/(tan(1/2*x)^2 + 1))*tan(1/2*x)^8 + 96*tan(1/2*x)^9 + 180*tan
(1/2*x)^8*tan(x) + 366*x*tan(1/2*x)^6*tan(x)^2 + 48*log(2*(tan(1/2*x)^2 + 2*tan(1/2*x) + 1)/(tan(1/2*x)^2 + 1)
)*tan(1/2*x)^6*tan(x)^2 - 48*log(2*(tan(1/2*x)^2 - 2*tan(1/2*x) + 1)/(tan(1/2*x)^2 + 1))*tan(1/2*x)^6*tan(x)^2
 + 128*tan(1/2*x)^7*tan(x)^2 - 256*tan(1/2*x)^6*tan(x)^3 - 16*tan(1/2*x)^4*tan(x)^5 + 366*x*tan(1/2*x)^6 + 48*
log(2*(tan(1/2*x)^2 + 2*tan(1/2*x) + 1)/(tan(1/2*x)^2 + 1))*tan(1/2*x)^6 - 48*log(2*(tan(1/2*x)^2 - 2*tan(1/2*
x) + 1)/(tan(1/2*x)^2 + 1))*tan(1/2*x)^6 + 128*tan(1/2*x)^7 - 360*tan(1/2*x)^6*tan(x) + 366*x*tan(1/2*x)^4*tan
(x)^2 + 48*log(2*(tan(1/2*x)^2 + 2*tan(1/2*x) + 1)/(tan(1/2*x)^2 + 1))*tan(1/2*x)^4*tan(x)^2 - 48*log(2*(tan(1
/2*x)^2 - 2*tan(1/2*x) + 1)/(tan(1/2*x)^2 + 1))*tan(1/2*x)^4*tan(x)^2 + 1088*tan(1/2*x)^5*tan(x)^2 - 256*tan(1
/2*x)^4*tan(x)^3 + 8*tan(1/2*x)^2*tan(x)^5 + 366*x*tan(1/2*x)^4 + 48*log(2*(tan(1/2*x)^2 + 2*tan(1/2*x) + 1)/(
tan(1/2*x)^2 + 1))*tan(1/2*x)^4 - 48*log(2*(tan(1/2*x)^2 - 2*tan(1/2*x) + 1)/(tan(1/2*x)^2 + 1))*tan(1/2*x)^4
+ 1088*tan(1/2*x)^5 - 360*tan(1/2*x)^4*tan(x) - 183*x*tan(1/2*x)^2*tan(x)^2 - 24*log(2*(tan(1/2*x)^2 + 2*tan(1
/2*x) + 1)/(tan(1/2*x)^2 + 1))*tan(1/2*x)^2*tan(x)^2 + 24*log(2*(tan(1/2*x)^2 - 2*tan(1/2*x) + 1)/(tan(1/2*x)^
2 + 1))*tan(1/2*x)^2*tan(x)^2 + 128*tan(1/2*x)^3*tan(x)^2 + 128*tan(1/2*x)^2*tan(x)^3 + 8*tan(x)^5 - 183*x*tan
(1/2*x)^2 - 24*log(2*(tan(1/2*x)^2 + 2*tan(1/2*x) + 1)/(tan(1/2*x)^2 + 1))*tan(1/2*x)^2 + 24*log(2*(tan(1/2*x)
^2 - 2*tan(1/2*x) + 1)/(tan(1/2*x)^2 + 1))*tan(1/2*x)^2 + 128*tan(1/2*x)^3 + 180*tan(1/2*x)^2*tan(x) - 183*x*t
an(x)^2 - 24*log(2*(tan(1/2*x)^2 + 2*tan(1/2*x) + 1)/(tan(1/2*x)^2 + 1))*tan(x)^2 + 24*log(2*(tan(1/2*x)^2 - 2
*tan(1/2*x) + 1)/(tan(1/2*x)^2 + 1))*tan(x)^2 + 96*tan(1/2*x)*tan(x)^2 + 128*tan(x)^3 - 183*x - 24*log(2*(tan(
1/2*x)^2 + 2*tan(1/2*x) + 1)/(tan(1/2*x)^2 + 1)) + 24*log(2*(tan(1/2*x)^2 - 2*tan(1/2*x) + 1)/(tan(1/2*x)^2 +
1)) + 96*tan(1/2*x) + 180*tan(x))/(tan(1/2*x)^10*tan(x)^2 + tan(1/2*x)^10 + tan(1/2*x)^8*tan(x)^2 + tan(1/2*x)
^8 - 2*tan(1/2*x)^6*tan(x)^2 - 2*tan(1/2*x)^6 - 2*tan(1/2*x)^4*tan(x)^2 - 2*tan(1/2*x)^4 + tan(1/2*x)^2*tan(x)
^2 + tan(1/2*x)^2 + tan(x)^2 + 1) + 1/32*sin(4*x)