\(\int (\sin (x)+\tan (x))^4 \, dx\) [341]
Optimal result
Integrand size = 7, antiderivative size = 55 \[
\int (\sin (x)+\tan (x))^4 \, dx=-\frac {61 x}{8}-2 \text {arctanh}(\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}
\]
[Out]
-61/8*x-2*arctanh(sin(x))+19/8*cos(x)*sin(x)+1/4*cos(x)^3*sin(x)-4/3*sin(x)^3+5*tan(x)+2*sec(x)*tan(x)+1/3*tan
(x)^3
Rubi [A] (verified)
Time = 0.15 (sec) , antiderivative size = 55, normalized size of antiderivative = 1.00, number of
steps used = 18, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 1.286, Rules used = {4482, 2788, 2717, 2715, 8,
2713, 3855, 3852, 3853} \[
\int (\sin (x)+\tan (x))^4 \, dx=-2 \text {arctanh}(\sin (x))-\frac {61 x}{8}-\frac {4 \sin ^3(x)}{3}+\frac {\tan ^3(x)}{3}+5 \tan (x)+\frac {1}{4} \sin (x) \cos ^3(x)+\frac {19}{8} \sin (x) \cos (x)+2 \tan (x) \sec (x)
\]
[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 8
Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]
Rule 2713
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 2715
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] && Integ
erQ[2*n]
Rule 2717
Int[sin[Pi/2 + (c_.) + (d_.)*(x_)], x_Symbol] :> Simp[Sin[c + d*x]/d, x] /; FreeQ[{c, d}, x]
Rule 2788
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 3852
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 3853
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]
Rule 3855
Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]
Rule 4482
Int[u_, x_Symbol] :> Int[TrigSimplify[u], x] /; TrigSimplifyQ[u]
Rubi steps \begin{align*}
\text {integral}& = \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 \text {arctanh}(\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 \text {Subst}(\int 1 \, dx,x,-\tan (x))-4 \text {Subst}\left (\int \left (1-x^2\right ) \, dx,x,-\sin (x)\right )-\text {Subst}\left (\int \left (1+x^2\right ) \, dx,x,-\tan (x)\right ) \\ & = -8 x-2 \text {arctanh}(\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 \text {arctanh}(\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] (verified)
Leaf count is larger than twice the leaf count of optimal. \(129\) vs. \(2(55)=110\).
Time = 0.15 (sec) , antiderivative size = 129, normalized size of antiderivative = 2.35
\[
\int (\sin (x)+\tan (x))^4 \, dx=\frac {1}{768} \sec ^3(x) \left (-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 (\cos \left (\frac {x}{2}\right )+\sin \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 (\cos \left (\frac {x}{2}\right )+\sin \left (\frac {x}{2}\right )\right )\right )+1395 \sin (x)+672 \sin (2 x)+1265 \sin (3 x)+129 \sin (5 x)+32 \sin (6 x)+3 \sin (7 x)\right )
\]
[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] (verified)
Time = 0.57 (sec) , antiderivative size = 66, normalized size of antiderivative = 1.20
\[\frac {23 \left (\sin \left (x \right )^{3}+\frac {3 \sin \left (x \right )}{2}\right ) \cos \left (x \right )}{4}-\frac {61 x}{8}+\frac {2 \sin \left (x \right )^{3}}{3}+2 \sin \left (x \right )-2 \ln \left (\sec \left (x \right )+\tan \left (x \right )\right )+\frac {6 \sin \left (x \right )^{5}}{\cos \left (x \right )}+\frac {2 \sin \left (x \right )^{5}}{\cos \left (x \right )^{2}}+\frac {\tan \left (x \right )^{3}}{3}-\tan \left (x \right )\]
[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)
Fricas [A] (verification not implemented)
none
Time = 0.25 (sec) , antiderivative size = 78, normalized size of antiderivative = 1.42
\[
\int (\sin (x)+\tan (x))^4 \, dx=-\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}}
\]
[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] (verification not implemented)
Time = 1.63 (sec) , antiderivative size = 90, normalized size of antiderivative = 1.64
\[
\int (\sin (x)+\tan (x))^4 \, dx=- \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}
\]
[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)
Maxima [A] (verification not implemented)
none
Time = 0.30 (sec) , antiderivative size = 68, normalized size of antiderivative = 1.24
\[
\int (\sin (x)+\tan (x))^4 \, dx=-\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 )
\]
[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)
Giac [B] (verification not implemented)
Leaf count of result is larger than twice the leaf count of optimal. 1375 vs. \(2 (45) = 90\).
Time = 3.10 (sec) , antiderivative size = 1375, normalized size of antiderivative = 25.00
\[
\int (\sin (x)+\tan (x))^4 \, dx=\text {Too large to display}
\]
[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)
Mupad [B] (verification not implemented)
Time = 29.10 (sec) , antiderivative size = 88, normalized size of antiderivative = 1.60
\[
\int (\sin (x)+\tan (x))^4 \, dx=-\frac {61\,x}{8}-4\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {x}{2}\right )\right )-\frac {\frac {45\,{\mathrm {tan}\left (\frac {x}{2}\right )}^{13}}{4}+\frac {29\,{\mathrm {tan}\left (\frac {x}{2}\right )}^{11}}{6}-\frac {455\,{\mathrm {tan}\left (\frac {x}{2}\right )}^9}{12}-15\,{\mathrm {tan}\left (\frac {x}{2}\right )}^7+\frac {179\,{\mathrm {tan}\left (\frac {x}{2}\right )}^5}{4}+\frac {31\,{\mathrm {tan}\left (\frac {x}{2}\right )}^3}{2}+\frac {77\,\mathrm {tan}\left (\frac {x}{2}\right )}{4}}{{\left ({\mathrm {tan}\left (\frac {x}{2}\right )}^2-1\right )}^3\,{\left ({\mathrm {tan}\left (\frac {x}{2}\right )}^2+1\right )}^4}
\]
[In]
int((sin(x) + tan(x))^4,x)
[Out]
- (61*x)/8 - 4*atanh(tan(x/2)) - ((77*tan(x/2))/4 + (31*tan(x/2)^3)/2 + (179*tan(x/2)^5)/4 - 15*tan(x/2)^7 - (
455*tan(x/2)^9)/12 + (29*tan(x/2)^11)/6 + (45*tan(x/2)^13)/4)/((tan(x/2)^2 - 1)^3*(tan(x/2)^2 + 1)^4)