3.342 \(\int (\sin (x)+\tan (x))^3 \, dx\)

Optimal. Leaf size=38 \[ \frac {\cos ^3(x)}{3}+\frac {3 \cos ^2(x)}{2}+2 \cos (x)+\frac {\sec ^2(x)}{2}+3 \sec (x)-2 \log (\cos (x)) \]

[Out]

2*cos(x)+3/2*cos(x)^2+1/3*cos(x)^3-2*ln(cos(x))+3*sec(x)+1/2*sec(x)^2

________________________________________________________________________________________

Rubi [A]  time = 0.05, antiderivative size = 38, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.429, Rules used = {4397, 2707, 75} \[ \frac {\cos ^3(x)}{3}+\frac {3 \cos ^2(x)}{2}+2 \cos (x)+\frac {\sec ^2(x)}{2}+3 \sec (x)-2 \log (\cos (x)) \]

Antiderivative was successfully verified.

[In]

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

[Out]

2*Cos[x] + (3*Cos[x]^2)/2 + Cos[x]^3/3 - 2*Log[Cos[x]] + 3*Sec[x] + Sec[x]^2/2

Rule 75

Int[((d_.)*(x_))^(n_.)*((a_) + (b_.)*(x_))*((e_) + (f_.)*(x_))^(p_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*
x)*(d*x)^n*(e + f*x)^p, x], x] /; FreeQ[{a, b, d, e, f, n}, x] && IGtQ[p, 0] && EqQ[b*e + a*f, 0] &&  !(ILtQ[n
 + p + 2, 0] && GtQ[n + 2*p, 0])

Rule 2707

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*tan[(e_.) + (f_.)*(x_)]^(p_.), x_Symbol] :> Dist[1/f, Subst[I
nt[(x^p*(a + x)^(m - (p + 1)/2))/(a - x)^((p + 1)/2), x], x, b*Sin[e + f*x]], x] /; FreeQ[{a, b, e, f, m}, x]
&& EqQ[a^2 - b^2, 0] && IntegerQ[(p + 1)/2]

Rule 4397

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

Rubi steps

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

________________________________________________________________________________________

Mathematica [A]  time = 0.04, size = 40, normalized size = 1.05 \[ \frac {9 \cos (x)}{4}+\frac {3}{4} \cos (2 x)+\frac {1}{12} \cos (3 x)+\frac {\sec ^2(x)}{2}+3 \sec (x)-2 \log (\cos (x)) \]

Antiderivative was successfully verified.

[In]

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

[Out]

(9*Cos[x])/4 + (3*Cos[2*x])/4 + Cos[3*x]/12 - 2*Log[Cos[x]] + 3*Sec[x] + Sec[x]^2/2

________________________________________________________________________________________

fricas [A]  time = 2.02, size = 47, normalized size = 1.24 \[ \frac {4 \, \cos \relax (x)^{5} + 18 \, \cos \relax (x)^{4} + 24 \, \cos \relax (x)^{3} - 24 \, \cos \relax (x)^{2} \log \left (-\cos \relax (x)\right ) - 9 \, \cos \relax (x)^{2} + 36 \, \cos \relax (x) + 6}{12 \, \cos \relax (x)^{2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/12*(4*cos(x)^5 + 18*cos(x)^4 + 24*cos(x)^3 - 24*cos(x)^2*log(-cos(x)) - 9*cos(x)^2 + 36*cos(x) + 6)/cos(x)^2

________________________________________________________________________________________

giac [B]  time = 0.45, size = 173, normalized size = 4.55 \[ \frac {\tan \left (\frac {1}{2} \, x\right )^{4} \tan \relax (x)^{4} - 2 \, \log \left (\frac {4}{\tan \relax (x)^{2} + 1}\right ) \tan \left (\frac {1}{2} \, x\right )^{4} \tan \relax (x)^{2} - 10 \, \tan \left (\frac {1}{2} \, x\right )^{4} \tan \relax (x)^{2} - 2 \, \log \left (\frac {4}{\tan \relax (x)^{2} + 1}\right ) \tan \left (\frac {1}{2} \, x\right )^{4} - 8 \, \tan \left (\frac {1}{2} \, x\right )^{4} - 3 \, \tan \left (\frac {1}{2} \, x\right )^{2} \tan \relax (x)^{2} - \tan \relax (x)^{4} + 2 \, \log \left (\frac {4}{\tan \relax (x)^{2} + 1}\right ) \tan \relax (x)^{2} - 3 \, \tan \left (\frac {1}{2} \, x\right )^{2} - 11 \, \tan \relax (x)^{2} + 2 \, \log \left (\frac {4}{\tan \relax (x)^{2} + 1}\right ) - 13}{2 \, {\left (\tan \left (\frac {1}{2} \, x\right )^{4} \tan \relax (x)^{2} + \tan \left (\frac {1}{2} \, x\right )^{4} - \tan \relax (x)^{2} - 1\right )}} + \frac {1}{12} \, \cos \left (3 \, x\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/2*(tan(1/2*x)^4*tan(x)^4 - 2*log(4/(tan(x)^2 + 1))*tan(1/2*x)^4*tan(x)^2 - 10*tan(1/2*x)^4*tan(x)^2 - 2*log(
4/(tan(x)^2 + 1))*tan(1/2*x)^4 - 8*tan(1/2*x)^4 - 3*tan(1/2*x)^2*tan(x)^2 - tan(x)^4 + 2*log(4/(tan(x)^2 + 1))
*tan(x)^2 - 3*tan(1/2*x)^2 - 11*tan(x)^2 + 2*log(4/(tan(x)^2 + 1)) - 13)/(tan(1/2*x)^4*tan(x)^2 + tan(1/2*x)^4
 - tan(x)^2 - 1) + 1/12*cos(3*x)

________________________________________________________________________________________

maple [A]  time = 0.07, size = 39, normalized size = 1.03 \[ \frac {8 \left (2+\sin ^{2}\relax (x )\right ) \cos \relax (x )}{3}-\frac {3 \left (\sin ^{2}\relax (x )\right )}{2}-2 \ln \left (\cos \relax (x )\right )+\frac {3 \left (\sin ^{4}\relax (x )\right )}{\cos \relax (x )}+\frac {\left (\tan ^{2}\relax (x )\right )}{2} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

8/3*(2+sin(x)^2)*cos(x)-3/2*sin(x)^2-2*ln(cos(x))+3*sin(x)^4/cos(x)+1/2*tan(x)^2

________________________________________________________________________________________

maxima [A]  time = 0.32, size = 42, normalized size = 1.11 \[ \frac {1}{3} \, \cos \relax (x)^{3} - \frac {3}{2} \, \sin \relax (x)^{2} - \frac {1}{2 \, {\left (\sin \relax (x)^{2} - 1\right )}} + \frac {3}{\cos \relax (x)} + 2 \, \cos \relax (x) - \log \left (\sin \relax (x)^{2} - 1\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/3*cos(x)^3 - 3/2*sin(x)^2 - 1/2/(sin(x)^2 - 1) + 3/cos(x) + 2*cos(x) - log(sin(x)^2 - 1)

________________________________________________________________________________________

mupad [B]  time = 2.45, size = 65, normalized size = 1.71 \[ 4\,\mathrm {atanh}\left ({\mathrm {tan}\left (\frac {x}{2}\right )}^2\right )+\frac {-4\,{\mathrm {tan}\left (\frac {x}{2}\right )}^8-4\,{\mathrm {tan}\left (\frac {x}{2}\right )}^6+\frac {20\,{\mathrm {tan}\left (\frac {x}{2}\right )}^4}{3}+\frac {20\,{\mathrm {tan}\left (\frac {x}{2}\right )}^2}{3}+\frac {32}{3}}{{\left ({\mathrm {tan}\left (\frac {x}{2}\right )}^2-1\right )}^2\,{\left ({\mathrm {tan}\left (\frac {x}{2}\right )}^2+1\right )}^3} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

4*atanh(tan(x/2)^2) + ((20*tan(x/2)^2)/3 + (20*tan(x/2)^4)/3 - 4*tan(x/2)^6 - 4*tan(x/2)^8 + 32/3)/((tan(x/2)^
2 - 1)^2*(tan(x/2)^2 + 1)^3)

________________________________________________________________________________________

sympy [A]  time = 5.99, size = 46, normalized size = 1.21 \[ - 3 \log {\left (\cos {\relax (x )} \right )} - \frac {\log {\left (\sec ^{2}{\relax (x )} \right )}}{2} + \frac {\cos ^{3}{\relax (x )}}{3} + \frac {3 \cos ^{2}{\relax (x )}}{2} + 2 \cos {\relax (x )} + \frac {\sec ^{2}{\relax (x )}}{2} + \frac {3}{\cos {\relax (x )}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-3*log(cos(x)) - log(sec(x)**2)/2 + cos(x)**3/3 + 3*cos(x)**2/2 + 2*cos(x) + sec(x)**2/2 + 3/cos(x)

________________________________________________________________________________________