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

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

Optimal result

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

2*a*b*arctanh(sin(d*x+c))/d-a^2*cos(d*x+c)/d+2*b^2*cos(d*x+c)/d+1/3*a^2*co 
s(d*x+c)^3/d-1/3*b^2*cos(d*x+c)^3/d+b^2*sec(d*x+c)/d-2*a*b*sin(d*x+c)/d-2/ 
3*a*b*sin(d*x+c)^3/d
 

Mathematica [A] (verified)

Time = 1.04 (sec) , antiderivative size = 152, normalized size of antiderivative = 1.25 \[ \int \sin ^3(c+d x) (a+b \tan (c+d x))^2 \, dx=\frac {\sec (c+d x) \left (-9 a^2+45 b^2+\left (-8 a^2+20 b^2\right ) \cos (2 (c+d x))+\left (a^2-b^2\right ) \cos (4 (c+d x))-48 a b \cos (c+d x) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+48 a b \cos (c+d x) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )-28 a b \sin (2 (c+d x))+2 a b \sin (4 (c+d x))\right )}{24 d} \] Input:

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

Output:

(Sec[c + d*x]*(-9*a^2 + 45*b^2 + (-8*a^2 + 20*b^2)*Cos[2*(c + d*x)] + (a^2 
 - b^2)*Cos[4*(c + d*x)] - 48*a*b*Cos[c + d*x]*Log[Cos[(c + d*x)/2] - Sin[ 
(c + d*x)/2]] + 48*a*b*Cos[c + d*x]*Log[Cos[(c + d*x)/2] + Sin[(c + d*x)/2 
]] - 28*a*b*Sin[2*(c + d*x)] + 2*a*b*Sin[4*(c + d*x)]))/(24*d)
 

Rubi [A] (verified)

Time = 0.35 (sec) , antiderivative size = 122, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3042, 4000, 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 \sin ^3(c+d x) (a+b \tan (c+d x))^2 \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4000

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

\(\Big \downarrow \) 2009

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

Input:

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

Output:

(2*a*b*ArcTanh[Sin[c + d*x]])/d - (a^2*Cos[c + d*x])/d + (2*b^2*Cos[c + d* 
x])/d + (a^2*Cos[c + d*x]^3)/(3*d) - (b^2*Cos[c + d*x]^3)/(3*d) + (b^2*Sec 
[c + d*x])/d - (2*a*b*Sin[c + d*x])/d - (2*a*b*Sin[c + d*x]^3)/(3*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 4000
Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n 
_.), x_Symbol] :> Int[Expand[Sin[e + f*x]^m*(a + b*Tan[e + f*x])^n, x], x] 
/; FreeQ[{a, b, e, f}, x] && IntegerQ[(m - 1)/2] && IGtQ[n, 0]
 
Maple [A] (verified)

Time = 2.87 (sec) , antiderivative size = 113, normalized size of antiderivative = 0.93

method result size
derivativedivides \(\frac {-\frac {a^{2} \left (2+\sin \left (d x +c \right )^{2}\right ) \cos \left (d x +c \right )}{3}+2 a b \left (-\frac {\sin \left (d x +c \right )^{3}}{3}-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+b^{2} \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}\) \(113\)
default \(\frac {-\frac {a^{2} \left (2+\sin \left (d x +c \right )^{2}\right ) \cos \left (d x +c \right )}{3}+2 a b \left (-\frac {\sin \left (d x +c \right )^{3}}{3}-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+b^{2} \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}\) \(113\)
risch \(\frac {5 i {\mathrm e}^{i \left (d x +c \right )} a b}{4 d}-\frac {3 \,{\mathrm e}^{i \left (d x +c \right )} a^{2}}{8 d}+\frac {7 \,{\mathrm e}^{i \left (d x +c \right )} b^{2}}{8 d}-\frac {5 i {\mathrm e}^{-i \left (d x +c \right )} a b}{4 d}-\frac {3 \,{\mathrm e}^{-i \left (d x +c \right )} a^{2}}{8 d}+\frac {7 \,{\mathrm e}^{-i \left (d x +c \right )} b^{2}}{8 d}+\frac {2 b^{2} {\mathrm e}^{i \left (d x +c \right )}}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}-\frac {2 a b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{d}+\frac {2 a b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{d}+\frac {\cos \left (3 d x +3 c \right ) a^{2}}{12 d}-\frac {\cos \left (3 d x +3 c \right ) b^{2}}{12 d}+\frac {a b \sin \left (3 d x +3 c \right )}{6 d}\) \(224\)

Input:

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

Output:

1/d*(-1/3*a^2*(2+sin(d*x+c)^2)*cos(d*x+c)+2*a*b*(-1/3*sin(d*x+c)^3-sin(d*x 
+c)+ln(sec(d*x+c)+tan(d*x+c)))+b^2*(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.12 (sec) , antiderivative size = 126, normalized size of antiderivative = 1.03 \[ \int \sin ^3(c+d x) (a+b \tan (c+d x))^2 \, dx=\frac {{\left (a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{4} + 3 \, a b \cos \left (d x + c\right ) \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \, a b \cos \left (d x + c\right ) \log \left (-\sin \left (d x + c\right ) + 1\right ) - 3 \, {\left (a^{2} - 2 \, b^{2}\right )} \cos \left (d x + c\right )^{2} + 3 \, b^{2} + 2 \, {\left (a b \cos \left (d x + c\right )^{3} - 4 \, a b \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{3 \, d \cos \left (d x + c\right )} \] Input:

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

Output:

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

Sympy [F]

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

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

Output:

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

Maxima [A] (verification not implemented)

Time = 0.04 (sec) , antiderivative size = 104, normalized size of antiderivative = 0.85 \[ \int \sin ^3(c+d x) (a+b \tan (c+d x))^2 \, dx=\frac {{\left (\cos \left (d x + c\right )^{3} - 3 \, \cos \left (d x + c\right )\right )} a^{2} - {\left (2 \, \sin \left (d x + c\right )^{3} - 3 \, \log \left (\sin \left (d x + c\right ) + 1\right ) + 3 \, \log \left (\sin \left (d x + c\right ) - 1\right ) + 6 \, \sin \left (d x + c\right )\right )} a b - {\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^{2}}{3 \, d} \] Input:

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

Output:

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

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 32694 vs. \(2 (116) = 232\).

Time = 14.65 (sec) , antiderivative size = 32694, normalized size of antiderivative = 267.98 \[ \int \sin ^3(c+d x) (a+b \tan (c+d x))^2 \, dx=\text {Too large to display} \] Input:

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

Output:

1/192*(15*pi*b^2*sgn(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)^2*tan(1/ 
2*c) + tan(1/2*d*x)^2 - tan(1/2*c)^2 + 2*tan(1/2*c) - 1)*sgn(tan(1/2*d*x)^ 
2*tan(1/2*c)^2 + 2*tan(1/2*d*x)*tan(1/2*c)^2 - tan(1/2*d*x)^2 + tan(1/2*c) 
^2 + 2*tan(1/2*d*x) - 1)*tan(1/2*d*x)^8*tan(1/2*c)^8 + 15*pi*b^2*sgn(tan(1 
/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)^2*tan(1/2*c) + tan(1/2*d*x)^2 - ta 
n(1/2*c)^2 - 2*tan(1/2*c) - 1)*sgn(tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2 
*d*x)*tan(1/2*c)^2 - tan(1/2*d*x)^2 + tan(1/2*c)^2 - 2*tan(1/2*d*x) - 1)*t 
an(1/2*d*x)^8*tan(1/2*c)^8 - 15*pi*b^2*sgn(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2 
*tan(1/2*d*x)*tan(1/2*c)^2 - tan(1/2*d*x)^2 + tan(1/2*c)^2 + 2*tan(1/2*d*x 
) - 1)*tan(1/2*d*x)^8*tan(1/2*c)^8 + 15*pi*b^2*sgn(tan(1/2*d*x)^2*tan(1/2* 
c)^2 - 2*tan(1/2*d*x)*tan(1/2*c)^2 - tan(1/2*d*x)^2 + tan(1/2*c)^2 - 2*tan 
(1/2*d*x) - 1)*tan(1/2*d*x)^8*tan(1/2*c)^8 - 30*pi*b^2*sgn(tan(1/2*d*x)^2* 
tan(1/2*c)^2 - tan(1/2*d*x)^2 - 4*tan(1/2*d*x)*tan(1/2*c) - tan(1/2*c)^2 + 
 1)*tan(1/2*d*x)^8*tan(1/2*c)^8 + 30*pi*b^2*sgn(tan(1/2*d*x)^2*tan(1/2*c)^ 
2 + 2*tan(1/2*d*x)^2*tan(1/2*c) + tan(1/2*d*x)^2 - tan(1/2*c)^2 + 2*tan(1/ 
2*c) - 1)*sgn(tan(1/2*d*x)^2*tan(1/2*c)^2 + 2*tan(1/2*d*x)*tan(1/2*c)^2 - 
tan(1/2*d*x)^2 + tan(1/2*c)^2 + 2*tan(1/2*d*x) - 1)*tan(1/2*d*x)^8*tan(1/2 
*c)^6 + 30*pi*b^2*sgn(tan(1/2*d*x)^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)^2*tan(1 
/2*c) + tan(1/2*d*x)^2 - tan(1/2*c)^2 - 2*tan(1/2*c) - 1)*sgn(tan(1/2*d*x) 
^2*tan(1/2*c)^2 - 2*tan(1/2*d*x)*tan(1/2*c)^2 - tan(1/2*d*x)^2 + tan(1/...
 

Mupad [B] (verification not implemented)

Time = 3.90 (sec) , antiderivative size = 174, normalized size of antiderivative = 1.43 \[ \int \sin ^3(c+d x) (a+b \tan (c+d x))^2 \, dx=\frac {4\,a\,b\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d}-\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,\left (\frac {8\,a^2}{3}-\frac {32\,b^2}{3}\right )-4\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4+\frac {4\,a^2}{3}-\frac {16\,b^2}{3}+\frac {28\,a\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3}{3}-\frac {28\,a\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5}{3}-4\,a\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^7+4\,a\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{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 )} \] Input:

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

Output:

(4*a*b*atanh(tan(c/2 + (d*x)/2)))/d - (tan(c/2 + (d*x)/2)^2*((8*a^2)/3 - ( 
32*b^2)/3) - 4*a^2*tan(c/2 + (d*x)/2)^4 + (4*a^2)/3 - (16*b^2)/3 + (28*a*b 
*tan(c/2 + (d*x)/2)^3)/3 - (28*a*b*tan(c/2 + (d*x)/2)^5)/3 - 4*a*b*tan(c/2 
 + (d*x)/2)^7 + 4*a*b*tan(c/2 + (d*x)/2))/(d*(2*tan(c/2 + (d*x)/2)^2 - 2*t 
an(c/2 + (d*x)/2)^6 - tan(c/2 + (d*x)/2)^8 + 1))
 

Reduce [B] (verification not implemented)

Time = 0.20 (sec) , antiderivative size = 174, normalized size of antiderivative = 1.43 \[ \int \sin ^3(c+d x) (a+b \tan (c+d x))^2 \, dx=\frac {-6 \cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) a b +6 \cos \left (d x +c \right ) \mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) a b -2 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{3} a b -6 \cos \left (d x +c \right ) \sin \left (d x +c \right ) a b +2 \cos \left (d x +c \right ) a^{2}-8 \cos \left (d x +c \right ) b^{2}+\sin \left (d x +c \right )^{4} a^{2}-\sin \left (d x +c \right )^{4} b^{2}+\sin \left (d x +c \right )^{2} a^{2}-4 \sin \left (d x +c \right )^{2} b^{2}-2 a^{2}+8 b^{2}}{3 \cos \left (d x +c \right ) d} \] Input:

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

Output:

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