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

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(-2)]
Mupad [B] (verification not implemented)
Reduce [B] (verification not implemented)

Optimal result

Integrand size = 19, antiderivative size = 116 \[ \int (a \sin (c+d x)+b \tan (c+d x))^3 \, dx=-\frac {a \left (a^2-3 b^2\right ) \cos (c+d x)}{d}+\frac {3 a^2 b \cos ^2(c+d x)}{2 d}+\frac {a^3 \cos ^3(c+d x)}{3 d}-\frac {b \left (3 a^2-b^2\right ) \log (\cos (c+d x))}{d}+\frac {3 a b^2 \sec (c+d x)}{d}+\frac {b^3 \sec ^2(c+d x)}{2 d} \] Output:

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

Mathematica [A] (verified)

Time = 0.58 (sec) , antiderivative size = 102, normalized size of antiderivative = 0.88 \[ \int (a \sin (c+d x)+b \tan (c+d x))^3 \, dx=\frac {-9 a \left (a^2-4 b^2\right ) \cos (c+d x)+9 a^2 b \cos (2 (c+d x))+a^3 \cos (3 (c+d x))-36 a^2 b \log (\cos (c+d x))+12 b^3 \log (\cos (c+d x))+36 a b^2 \sec (c+d x)+6 b^3 \sec ^2(c+d x)}{12 d} \] Input:

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

Output:

(-9*a*(a^2 - 4*b^2)*Cos[c + d*x] + 9*a^2*b*Cos[2*(c + d*x)] + a^3*Cos[3*(c 
 + d*x)] - 36*a^2*b*Log[Cos[c + d*x]] + 12*b^3*Log[Cos[c + d*x]] + 36*a*b^ 
2*Sec[c + d*x] + 6*b^3*Sec[c + d*x]^2)/(12*d)
 

Rubi [A] (verified)

Time = 0.36 (sec) , antiderivative size = 103, normalized size of antiderivative = 0.89, number of steps used = 8, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.368, Rules used = {3042, 4897, 3042, 25, 3200, 522, 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 (a \sin (c+d x)+b \tan (c+d x))^3 \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4897

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

\(\Big \downarrow \) 3042

\(\displaystyle \int -\frac {\left (b-a \sin \left (c+d x-\frac {\pi }{2}\right )\right )^3}{\tan \left (c+d x-\frac {\pi }{2}\right )^3}dx\)

\(\Big \downarrow \) 25

\(\displaystyle -\int \frac {\left (b-a \sin \left (\frac {1}{2} (2 c-\pi )+d x\right )\right )^3}{\tan \left (\frac {1}{2} (2 c-\pi )+d x\right )^3}dx\)

\(\Big \downarrow \) 3200

\(\displaystyle -\frac {\int \frac {(b+a \cos (c+d x))^3 \left (a^2-a^2 \cos ^2(c+d x)\right ) \sec ^3(c+d x)}{a^3}d(a \cos (c+d x))}{d}\)

\(\Big \downarrow \) 522

\(\displaystyle -\frac {\int \left (\frac {b^3 \sec ^3(c+d x)}{a}+3 b^2 \sec ^2(c+d x)+\frac {\left (3 a^2 b-b^3\right ) \sec (c+d x)}{a}-a^2 \cos ^2(c+d x)+a^2 \left (1-\frac {3 b^2}{a^2}\right )-3 a b \cos (c+d x)\right )d(a \cos (c+d x))}{d}\)

\(\Big \downarrow \) 2009

\(\displaystyle -\frac {-\frac {1}{3} a^3 \cos ^3(c+d x)+a \left (a^2-3 b^2\right ) \cos (c+d x)+b \left (3 a^2-b^2\right ) \log (a \cos (c+d x))-\frac {3}{2} a^2 b \cos ^2(c+d x)-3 a b^2 \sec (c+d x)-\frac {1}{2} b^3 \sec ^2(c+d x)}{d}\)

Input:

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

Output:

-((a*(a^2 - 3*b^2)*Cos[c + d*x] - (3*a^2*b*Cos[c + d*x]^2)/2 - (a^3*Cos[c 
+ d*x]^3)/3 + b*(3*a^2 - b^2)*Log[a*Cos[c + d*x]] - 3*a*b^2*Sec[c + d*x] - 
 (b^3*Sec[c + d*x]^2)/2)/d)
 

Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 522
Int[((e_.)*(x_))^(m_.)*((c_) + (d_.)*(x_))^(n_.)*((a_) + (b_.)*(x_)^2)^(p_. 
), x_Symbol] :> Int[ExpandIntegrand[(e*x)^m*(c + d*x)^n*(a + b*x^2)^p, x], 
x] /; FreeQ[{a, b, c, d, e, m, n}, x] && IGtQ[p, 0]
 

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 3200
Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*tan[(e_.) + (f_.)*(x_)]^(p 
_.), x_Symbol] :> Simp[1/f   Subst[Int[(x^p*(a + x)^m)/(b^2 - x^2)^((p + 1) 
/2), x], x, b*Sin[e + f*x]], x] /; FreeQ[{a, b, e, f, m}, x] && NeQ[a^2 - b 
^2, 0] && IntegerQ[(p + 1)/2]
 

rule 4897
Int[u_, x_Symbol] :> Int[TrigSimplify[u], x] /; TrigSimplifyQ[u]
 
Maple [A] (verified)

Time = 4.12 (sec) , antiderivative size = 116, normalized size of antiderivative = 1.00

method result size
derivativedivides \(\frac {-\frac {a^{3} \left (2+\sin \left (d x +c \right )^{2}\right ) \cos \left (d x +c \right )}{3}+3 a^{2} b \left (-\frac {\sin \left (d x +c \right )^{2}}{2}-\ln \left (\cos \left (d x +c \right )\right )\right )+3 a \,b^{2} \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 )+b^{3} \left (\frac {\tan \left (d x +c \right )^{2}}{2}+\ln \left (\cos \left (d x +c \right )\right )\right )}{d}\) \(116\)
default \(\frac {-\frac {a^{3} \left (2+\sin \left (d x +c \right )^{2}\right ) \cos \left (d x +c \right )}{3}+3 a^{2} b \left (-\frac {\sin \left (d x +c \right )^{2}}{2}-\ln \left (\cos \left (d x +c \right )\right )\right )+3 a \,b^{2} \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 )+b^{3} \left (\frac {\tan \left (d x +c \right )^{2}}{2}+\ln \left (\cos \left (d x +c \right )\right )\right )}{d}\) \(116\)
parts \(-\frac {a^{3} \left (2+\sin \left (d x +c \right )^{2}\right ) \cos \left (d x +c \right )}{3 d}+\frac {b^{3} \left (\frac {\tan \left (d x +c \right )^{2}}{2}-\frac {\ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2}\right )}{d}+\frac {3 a \,b^{2} \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^{2} b \left (-\frac {\sin \left (d x +c \right )^{2}}{2}-\ln \left (\cos \left (d x +c \right )\right )\right )}{d}\) \(130\)
risch \(-\frac {2 i b^{3} c}{d}+3 i a^{2} b x +\frac {a^{3} {\mathrm e}^{3 i \left (d x +c \right )}}{24 d}+\frac {3 \,{\mathrm e}^{2 i \left (d x +c \right )} a^{2} b}{8 d}-\frac {3 a^{3} {\mathrm e}^{i \left (d x +c \right )}}{8 d}+\frac {3 a \,{\mathrm e}^{i \left (d x +c \right )} b^{2}}{2 d}-\frac {3 a^{3} {\mathrm e}^{-i \left (d x +c \right )}}{8 d}+\frac {3 a \,{\mathrm e}^{-i \left (d x +c \right )} b^{2}}{2 d}+\frac {3 \,{\mathrm e}^{-2 i \left (d x +c \right )} a^{2} b}{8 d}+\frac {a^{3} {\mathrm e}^{-3 i \left (d x +c \right )}}{24 d}-i x \,b^{3}+\frac {6 i b \,a^{2} c}{d}+\frac {2 b^{2} \left (3 a \,{\mathrm e}^{3 i \left (d x +c \right )}+b \,{\mathrm e}^{2 i \left (d x +c \right )}+3 a \,{\mathrm e}^{i \left (d x +c \right )}\right )}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{2}}-\frac {3 b \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) a^{2}}{d}+\frac {b^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d}\) \(275\)

Input:

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

Output:

1/d*(-1/3*a^3*(2+sin(d*x+c)^2)*cos(d*x+c)+3*a^2*b*(-1/2*sin(d*x+c)^2-ln(co 
s(d*x+c)))+3*a*b^2*(sin(d*x+c)^4/cos(d*x+c)+(2+sin(d*x+c)^2)*cos(d*x+c))+b 
^3*(1/2*tan(d*x+c)^2+ln(cos(d*x+c))))
 

Fricas [A] (verification not implemented)

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

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

Output:

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

Sympy [F]

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

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

Output:

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

Maxima [A] (verification not implemented)

Time = 0.03 (sec) , antiderivative size = 113, normalized size of antiderivative = 0.97 \[ \int (a \sin (c+d x)+b \tan (c+d x))^3 \, dx=\frac {{\left (\cos \left (d x + c\right )^{3} - 3 \, \cos \left (d x + c\right )\right )} a^{3}}{3 \, d} - \frac {3 \, {\left (\sin \left (d x + c\right )^{2} + \log \left (\sin \left (d x + c\right )^{2} - 1\right )\right )} a^{2} b}{2 \, d} - \frac {b^{3} {\left (\frac {1}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right )^{2} - 1\right )\right )}}{2 \, d} + \frac {3 \, a b^{2} {\left (\frac {1}{\cos \left (d x + c\right )} + \cos \left (d x + c\right )\right )}}{d} \] Input:

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

Output:

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

Giac [F(-2)]

Exception generated. \[ \int (a \sin (c+d x)+b \tan (c+d x))^3 \, dx=\text {Exception raised: TypeError} \] Input:

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

Output:

Exception raised: TypeError >> an error occurred running a Giac command:IN 
PUT:sage2:=int(sage0,sageVARx):;OUTPUT:Modgcd: no suitable evaluation poin 
tindex.cc index_m operator + Error: Bad Argument ValueDone
 

Mupad [B] (verification not implemented)

Time = 19.69 (sec) , antiderivative size = 219, normalized size of antiderivative = 1.89 \[ \int (a \sin (c+d x)+b \tan (c+d x))^3 \, dx=\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,\left (-\frac {4\,a^3}{3}-6\,a^2\,b+12\,a\,b^2+2\,b^3\right )-{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6\,\left (4\,a^3-6\,a^2\,b+12\,a\,b^2-6\,b^3\right )+{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4\,\left (\frac {20\,a^3}{3}+6\,a^2\,b-12\,a\,b^2+6\,b^3\right )+12\,a\,b^2-{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^8\,\left (6\,a^2\,b-2\,b^3\right )-\frac {4\,a^3}{3}}{d\,{\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2-1\right )}^2\,{\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )}^3}-\frac {2\,b^3\,\mathrm {atanh}\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\right )-6\,a^2\,b\,\mathrm {atanh}\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\right )}{d} \] Input:

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

Output:

(tan(c/2 + (d*x)/2)^2*(12*a*b^2 - 6*a^2*b - (4*a^3)/3 + 2*b^3) - tan(c/2 + 
 (d*x)/2)^6*(12*a*b^2 - 6*a^2*b + 4*a^3 - 6*b^3) + tan(c/2 + (d*x)/2)^4*(6 
*a^2*b - 12*a*b^2 + (20*a^3)/3 + 6*b^3) + 12*a*b^2 - tan(c/2 + (d*x)/2)^8* 
(6*a^2*b - 2*b^3) - (4*a^3)/3)/(d*(tan(c/2 + (d*x)/2)^2 - 1)^2*(tan(c/2 + 
(d*x)/2)^2 + 1)^3) - (2*b^3*atanh(tan(c/2 + (d*x)/2)^2) - 6*a^2*b*atanh(ta 
n(c/2 + (d*x)/2)^2))/d
 

Reduce [B] (verification not implemented)

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

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

Output:

( - 2*cos(c + d*x)**2*sin(c + d*x)**2*a**3 - 4*cos(c + d*x)**2*a**3 - 3*co 
s(c + d*x)*log(tan(c + d*x)**2 + 1)*b**3 + 18*cos(c + d*x)*log(tan((c + d* 
x)/2)**2 + 1)*a**2*b - 18*cos(c + d*x)*log(tan((c + d*x)/2) - 1)*a**2*b - 
18*cos(c + d*x)*log(tan((c + d*x)/2) + 1)*a**2*b - 9*cos(c + d*x)*sin(c + 
d*x)**2*a**2*b + 3*cos(c + d*x)*tan(c + d*x)**2*b**3 + 4*cos(c + d*x)*a**3 
 - 36*cos(c + d*x)*a*b**2 - 18*sin(c + d*x)**2*a*b**2 + 36*a*b**2)/(6*cos( 
c + d*x)*d)