\(\int (a+b \sin (c+d x))^3 \tan ^2(c+d x) \, dx\) [166]

Optimal result
Mathematica [A] (verified)
Rubi [A] (verified)
Maple [A] (verified)
Fricas [A] (verification not implemented)
Sympy [F]
Maxima [A] (verification not implemented)
Giac [F(-1)]
Mupad [B] (verification not implemented)
Reduce [B] (verification not implemented)

Optimal result

Integrand size = 21, antiderivative size = 142 \[ \int (a+b \sin (c+d x))^3 \tan ^2(c+d x) \, dx=-a^3 x-\frac {9}{2} a b^2 x+\frac {3 a^2 b \cos (c+d x)}{d}+\frac {2 b^3 \cos (c+d x)}{d}-\frac {b^3 \cos ^3(c+d x)}{3 d}+\frac {3 a^2 b \sec (c+d x)}{d}+\frac {b^3 \sec (c+d x)}{d}+\frac {3 a b^2 \cos (c+d x) \sin (c+d x)}{2 d}+\frac {a^3 \tan (c+d x)}{d}+\frac {3 a b^2 \tan (c+d x)}{d} \] Output:

-a^3*x-9/2*a*b^2*x+3*a^2*b*cos(d*x+c)/d+2*b^3*cos(d*x+c)/d-1/3*b^3*cos(d*x 
+c)^3/d+3*a^2*b*sec(d*x+c)/d+b^3*sec(d*x+c)/d+3/2*a*b^2*cos(d*x+c)*sin(d*x 
+c)/d+a^3*tan(d*x+c)/d+3*a*b^2*tan(d*x+c)/d
 

Mathematica [A] (verified)

Time = 0.98 (sec) , antiderivative size = 113, normalized size of antiderivative = 0.80 \[ \int (a+b \sin (c+d x))^3 \tan ^2(c+d x) \, dx=\frac {b \sec (c+d x) \left (108 a^2+45 b^2+4 \left (9 a^2+5 b^2\right ) \cos (2 (c+d x))-b^2 \cos (4 (c+d x))+9 a b \sin (3 (c+d x))\right )+3 a \left (-4 \left (2 a^2+9 b^2\right ) (c+d x)+\left (8 a^2+27 b^2\right ) \tan (c+d x)\right )}{24 d} \] Input:

Integrate[(a + b*Sin[c + d*x])^3*Tan[c + d*x]^2,x]
 

Output:

(b*Sec[c + d*x]*(108*a^2 + 45*b^2 + 4*(9*a^2 + 5*b^2)*Cos[2*(c + d*x)] - b 
^2*Cos[4*(c + d*x)] + 9*a*b*Sin[3*(c + d*x)]) + 3*a*(-4*(2*a^2 + 9*b^2)*(c 
 + d*x) + (8*a^2 + 27*b^2)*Tan[c + d*x]))/(24*d)
 

Rubi [A] (verified)

Time = 0.41 (sec) , antiderivative size = 146, normalized size of antiderivative = 1.03, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3042, 3201, 2009}

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 \tan ^2(c+d x) (a+b \sin (c+d x))^3 \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \tan (c+d x)^2 (a+b \sin (c+d x))^3dx\)

\(\Big \downarrow \) 3201

\(\displaystyle \int \left (a^3 \tan ^2(c+d x)+3 a^2 b \sin (c+d x) \tan ^2(c+d x)+3 a b^2 \sin ^2(c+d x) \tan ^2(c+d x)+b^3 \sin ^3(c+d x) \tan ^2(c+d x)\right )dx\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {a^3 \tan (c+d x)}{d}+a^3 (-x)+\frac {3 a^2 b \cos (c+d x)}{d}+\frac {3 a^2 b \sec (c+d x)}{d}+\frac {9 a b^2 \tan (c+d x)}{2 d}-\frac {3 a b^2 \sin ^2(c+d x) \tan (c+d x)}{2 d}-\frac {9}{2} a b^2 x-\frac {b^3 \cos ^3(c+d x)}{3 d}+\frac {2 b^3 \cos (c+d x)}{d}+\frac {b^3 \sec (c+d x)}{d}\)

Input:

Int[(a + b*Sin[c + d*x])^3*Tan[c + d*x]^2,x]
 

Output:

-(a^3*x) - (9*a*b^2*x)/2 + (3*a^2*b*Cos[c + d*x])/d + (2*b^3*Cos[c + d*x]) 
/d - (b^3*Cos[c + d*x]^3)/(3*d) + (3*a^2*b*Sec[c + d*x])/d + (b^3*Sec[c + 
d*x])/d + (a^3*Tan[c + d*x])/d + (9*a*b^2*Tan[c + d*x])/(2*d) - (3*a*b^2*S 
in[c + d*x]^2*Tan[c + d*x])/(2*d)
 

Defintions of rubi rules used

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3201
Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((g_.)*tan[(e_.) + (f_.)*( 
x_)])^(p_.), x_Symbol] :> Int[ExpandIntegrand[(g*Tan[e + f*x])^p, (a + b*Si 
n[e + f*x])^m, x], x] /; FreeQ[{a, b, e, f, g, p}, x] && NeQ[a^2 - b^2, 0] 
&& IGtQ[m, 0]
 
Maple [A] (verified)

Time = 4.91 (sec) , antiderivative size = 169, normalized size of antiderivative = 1.19

method result size
derivativedivides \(\frac {a^{3} \left (\tan \left (d x +c \right )-d x -c \right )+3 a^{2} b \left (\frac {\sin \left (d x +c \right )^{4}}{\cos \left (d x +c \right )}+\left (2+\sin \left (d x +c \right )^{2}\right ) \cos \left (d x +c \right )\right )+3 a \,b^{2} \left (\frac {\sin \left (d x +c \right )^{5}}{\cos \left (d x +c \right )}+\left (\sin \left (d x +c \right )^{3}+\frac {3 \sin \left (d x +c \right )}{2}\right ) \cos \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )+b^{3} \left (\frac {\sin \left (d x +c \right )^{6}}{\cos \left (d x +c \right )}+\left (\frac {8}{3}+\sin \left (d x +c \right )^{4}+\frac {4 \sin \left (d x +c \right )^{2}}{3}\right ) \cos \left (d x +c \right )\right )}{d}\) \(169\)
default \(\frac {a^{3} \left (\tan \left (d x +c \right )-d x -c \right )+3 a^{2} b \left (\frac {\sin \left (d x +c \right )^{4}}{\cos \left (d x +c \right )}+\left (2+\sin \left (d x +c \right )^{2}\right ) \cos \left (d x +c \right )\right )+3 a \,b^{2} \left (\frac {\sin \left (d x +c \right )^{5}}{\cos \left (d x +c \right )}+\left (\sin \left (d x +c \right )^{3}+\frac {3 \sin \left (d x +c \right )}{2}\right ) \cos \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )+b^{3} \left (\frac {\sin \left (d x +c \right )^{6}}{\cos \left (d x +c \right )}+\left (\frac {8}{3}+\sin \left (d x +c \right )^{4}+\frac {4 \sin \left (d x +c \right )^{2}}{3}\right ) \cos \left (d x +c \right )\right )}{d}\) \(169\)
parts \(\frac {a^{3} \left (\tan \left (d x +c \right )-\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}+\frac {b^{3} \left (\frac {\sin \left (d x +c \right )^{6}}{\cos \left (d x +c \right )}+\left (\frac {8}{3}+\sin \left (d x +c \right )^{4}+\frac {4 \sin \left (d x +c \right )^{2}}{3}\right ) \cos \left (d x +c \right )\right )}{d}+\frac {3 a^{2} b \left (\frac {\sin \left (d x +c \right )^{4}}{\cos \left (d x +c \right )}+\left (2+\sin \left (d x +c \right )^{2}\right ) \cos \left (d x +c \right )\right )}{d}+\frac {3 a \,b^{2} \left (\frac {\sin \left (d x +c \right )^{5}}{\cos \left (d x +c \right )}+\left (\sin \left (d x +c \right )^{3}+\frac {3 \sin \left (d x +c \right )}{2}\right ) \cos \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )}{d}\) \(179\)
risch \(-a^{3} x -\frac {9 a \,b^{2} x}{2}-\frac {3 i a \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}}{8 d}+\frac {3 b \,{\mathrm e}^{i \left (d x +c \right )} a^{2}}{2 d}+\frac {7 b^{3} {\mathrm e}^{i \left (d x +c \right )}}{8 d}+\frac {3 b \,{\mathrm e}^{-i \left (d x +c \right )} a^{2}}{2 d}+\frac {7 b^{3} {\mathrm e}^{-i \left (d x +c \right )}}{8 d}+\frac {3 i a \,b^{2} {\mathrm e}^{-2 i \left (d x +c \right )}}{8 d}+\frac {2 i a^{3}+6 i a \,b^{2}+6 a^{2} b \,{\mathrm e}^{i \left (d x +c \right )}+2 b^{3} {\mathrm e}^{i \left (d x +c \right )}}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}-\frac {b^{3} \cos \left (3 d x +3 c \right )}{12 d}\) \(200\)

Input:

int((a+b*sin(d*x+c))^3*tan(d*x+c)^2,x,method=_RETURNVERBOSE)
 

Output:

1/d*(a^3*(tan(d*x+c)-d*x-c)+3*a^2*b*(sin(d*x+c)^4/cos(d*x+c)+(2+sin(d*x+c) 
^2)*cos(d*x+c))+3*a*b^2*(sin(d*x+c)^5/cos(d*x+c)+(sin(d*x+c)^3+3/2*sin(d*x 
+c))*cos(d*x+c)-3/2*d*x-3/2*c)+b^3*(sin(d*x+c)^6/cos(d*x+c)+(8/3+sin(d*x+c 
)^4+4/3*sin(d*x+c)^2)*cos(d*x+c)))
 

Fricas [A] (verification not implemented)

Time = 0.09 (sec) , antiderivative size = 116, normalized size of antiderivative = 0.82 \[ \int (a+b \sin (c+d x))^3 \tan ^2(c+d x) \, dx=-\frac {2 \, b^{3} \cos \left (d x + c\right )^{4} + 3 \, {\left (2 \, a^{3} + 9 \, a b^{2}\right )} d x \cos \left (d x + c\right ) - 18 \, a^{2} b - 6 \, b^{3} - 6 \, {\left (3 \, a^{2} b + 2 \, b^{3}\right )} \cos \left (d x + c\right )^{2} - 3 \, {\left (3 \, a b^{2} \cos \left (d x + c\right )^{2} + 2 \, a^{3} + 6 \, a b^{2}\right )} \sin \left (d x + c\right )}{6 \, d \cos \left (d x + c\right )} \] Input:

integrate((a+b*sin(d*x+c))^3*tan(d*x+c)^2,x, algorithm="fricas")
 

Output:

-1/6*(2*b^3*cos(d*x + c)^4 + 3*(2*a^3 + 9*a*b^2)*d*x*cos(d*x + c) - 18*a^2 
*b - 6*b^3 - 6*(3*a^2*b + 2*b^3)*cos(d*x + c)^2 - 3*(3*a*b^2*cos(d*x + c)^ 
2 + 2*a^3 + 6*a*b^2)*sin(d*x + c))/(d*cos(d*x + c))
 

Sympy [F]

\[ \int (a+b \sin (c+d x))^3 \tan ^2(c+d x) \, dx=\int \left (a + b \sin {\left (c + d x \right )}\right )^{3} \tan ^{2}{\left (c + d x \right )}\, dx \] Input:

integrate((a+b*sin(d*x+c))**3*tan(d*x+c)**2,x)
 

Output:

Integral((a + b*sin(c + d*x))**3*tan(c + d*x)**2, x)
 

Maxima [A] (verification not implemented)

Time = 0.11 (sec) , antiderivative size = 119, normalized size of antiderivative = 0.84 \[ \int (a+b \sin (c+d x))^3 \tan ^2(c+d x) \, dx=-\frac {6 \, {\left (d x + c - \tan \left (d x + c\right )\right )} a^{3} + 9 \, {\left (3 \, d x + 3 \, c - \frac {\tan \left (d x + c\right )}{\tan \left (d x + c\right )^{2} + 1} - 2 \, \tan \left (d x + c\right )\right )} a b^{2} + 2 \, {\left (\cos \left (d x + c\right )^{3} - \frac {3}{\cos \left (d x + c\right )} - 6 \, \cos \left (d x + c\right )\right )} b^{3} - 18 \, a^{2} b {\left (\frac {1}{\cos \left (d x + c\right )} + \cos \left (d x + c\right )\right )}}{6 \, d} \] Input:

integrate((a+b*sin(d*x+c))^3*tan(d*x+c)^2,x, algorithm="maxima")
 

Output:

-1/6*(6*(d*x + c - tan(d*x + c))*a^3 + 9*(3*d*x + 3*c - tan(d*x + c)/(tan( 
d*x + c)^2 + 1) - 2*tan(d*x + c))*a*b^2 + 2*(cos(d*x + c)^3 - 3/cos(d*x + 
c) - 6*cos(d*x + c))*b^3 - 18*a^2*b*(1/cos(d*x + c) + cos(d*x + c)))/d
 

Giac [F(-1)]

Timed out. \[ \int (a+b \sin (c+d x))^3 \tan ^2(c+d x) \, dx=\text {Timed out} \] Input:

integrate((a+b*sin(d*x+c))^3*tan(d*x+c)^2,x, algorithm="giac")
 

Output:

Timed out
 

Mupad [B] (verification not implemented)

Time = 19.16 (sec) , antiderivative size = 249, normalized size of antiderivative = 1.75 \[ \int (a+b \sin (c+d x))^3 \tan ^2(c+d x) \, dx=\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (2\,a^3+9\,a\,b^2\right )+12\,a^2\,b+{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^7\,\left (2\,a^3+9\,a\,b^2\right )+{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\,\left (6\,a^3+15\,a\,b^2\right )+{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5\,\left (6\,a^3+15\,a\,b^2\right )+{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,\left (24\,a^2\,b+\frac {32\,b^3}{3}\right )+\frac {16\,b^3}{3}+12\,a^2\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4}{d\,\left (-{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^8-2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6+2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )}-\frac {a\,\mathrm {atan}\left (\frac {a\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (2\,a^2+9\,b^2\right )}{2\,a^3+9\,a\,b^2}\right )\,\left (2\,a^2+9\,b^2\right )}{d} \] Input:

int(tan(c + d*x)^2*(a + b*sin(c + d*x))^3,x)
 

Output:

(tan(c/2 + (d*x)/2)*(9*a*b^2 + 2*a^3) + 12*a^2*b + tan(c/2 + (d*x)/2)^7*(9 
*a*b^2 + 2*a^3) + tan(c/2 + (d*x)/2)^3*(15*a*b^2 + 6*a^3) + tan(c/2 + (d*x 
)/2)^5*(15*a*b^2 + 6*a^3) + tan(c/2 + (d*x)/2)^2*(24*a^2*b + (32*b^3)/3) + 
 (16*b^3)/3 + 12*a^2*b*tan(c/2 + (d*x)/2)^4)/(d*(2*tan(c/2 + (d*x)/2)^2 - 
2*tan(c/2 + (d*x)/2)^6 - tan(c/2 + (d*x)/2)^8 + 1)) - (a*atan((a*tan(c/2 + 
 (d*x)/2)*(2*a^2 + 9*b^2))/(9*a*b^2 + 2*a^3))*(2*a^2 + 9*b^2))/d
 

Reduce [B] (verification not implemented)

Time = 0.17 (sec) , antiderivative size = 171, normalized size of antiderivative = 1.20 \[ \int (a+b \sin (c+d x))^3 \tan ^2(c+d x) \, dx=\frac {6 \cos \left (d x +c \right ) \tan \left (d x +c \right ) a^{3}-6 \cos \left (d x +c \right ) a^{3} d x -36 \cos \left (d x +c \right ) a^{2} b -27 \cos \left (d x +c \right ) a \,b^{2} c -27 \cos \left (d x +c \right ) a \,b^{2} d x -16 \cos \left (d x +c \right ) b^{3}-2 \sin \left (d x +c \right )^{4} b^{3}-9 \sin \left (d x +c \right )^{3} a \,b^{2}-18 \sin \left (d x +c \right )^{2} a^{2} b -8 \sin \left (d x +c \right )^{2} b^{3}+27 \sin \left (d x +c \right ) a \,b^{2}+36 a^{2} b +16 b^{3}}{6 \cos \left (d x +c \right ) d} \] Input:

int((a+b*sin(d*x+c))^3*tan(d*x+c)^2,x)
 

Output:

(6*cos(c + d*x)*tan(c + d*x)*a**3 - 6*cos(c + d*x)*a**3*d*x - 36*cos(c + d 
*x)*a**2*b - 27*cos(c + d*x)*a*b**2*c - 27*cos(c + d*x)*a*b**2*d*x - 16*co 
s(c + d*x)*b**3 - 2*sin(c + d*x)**4*b**3 - 9*sin(c + d*x)**3*a*b**2 - 18*s 
in(c + d*x)**2*a**2*b - 8*sin(c + d*x)**2*b**3 + 27*sin(c + d*x)*a*b**2 + 
36*a**2*b + 16*b**3)/(6*cos(c + d*x)*d)