\(\int \sec ^2(c+d x) (a \cos (c+d x)+b \sin (c+d x))^3 \, dx\) [64]

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

Optimal result

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

3*a*b^2*arctanh(sin(d*x+c))/d-3*a^2*b*cos(d*x+c)/d+b^3*cos(d*x+c)/d+b^3*se 
c(d*x+c)/d+a^3*sin(d*x+c)/d-3*a*b^2*sin(d*x+c)/d
 

Mathematica [A] (verified)

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

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

Output:

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

Rubi [A] (verified)

Time = 0.31 (sec) , antiderivative size = 86, 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.107, Rules used = {3042, 3569, 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 \sec ^2(c+d x) (a \cos (c+d x)+b \sin (c+d x))^3 \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {(a \cos (c+d x)+b \sin (c+d x))^3}{\cos (c+d x)^2}dx\)

\(\Big \downarrow \) 3569

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

\(\Big \downarrow \) 2009

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

Input:

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

Output:

(3*a*b^2*ArcTanh[Sin[c + d*x]])/d - (3*a^2*b*Cos[c + d*x])/d + (b^3*Cos[c 
+ d*x])/d + (b^3*Sec[c + d*x])/d + (a^3*Sin[c + d*x])/d - (3*a*b^2*Sin[c + 
 d*x])/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 3569
Int[cos[(c_.) + (d_.)*(x_)]^(m_.)*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*si 
n[(c_.) + (d_.)*(x_)])^(n_.), x_Symbol] :> Int[ExpandTrig[cos[c + d*x]^m*(a 
*cos[c + d*x] + b*sin[c + d*x])^n, x], x] /; FreeQ[{a, b, c, d}, x] && Inte 
gerQ[m] && IGtQ[n, 0]
 
Maple [A] (verified)

Time = 0.45 (sec) , antiderivative size = 96, normalized size of antiderivative = 1.12

method result size
derivativedivides \(\frac {\sin \left (d x +c \right ) a^{3}-3 \cos \left (d x +c \right ) a^{2} b +3 a \,b^{2} \left (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+b^{3} \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}\) \(96\)
default \(\frac {\sin \left (d x +c \right ) a^{3}-3 \cos \left (d x +c \right ) a^{2} b +3 a \,b^{2} \left (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )+b^{3} \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}\) \(96\)
parts \(\frac {a^{3} \sin \left (d x +c \right )}{d}+\frac {b^{3} \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 (-\sin \left (d x +c \right )+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )}{d}-\frac {3 a^{2} b \cos \left (d x +c \right )}{d}\) \(104\)
parallelrisch \(\frac {3 \left (-\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+1\right ) a \,b^{2} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+3 a \,b^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}-1\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )+2 \left (a^{3}-3 a \,b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}-6 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} a^{2} b +2 \left (-a^{3}+3 a \,b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+6 a^{2} b -4 b^{3}}{d \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}-1\right )}\) \(159\)
risch \(-\frac {3 \,{\mathrm e}^{i \left (d x +c \right )} a^{2} b}{2 d}+\frac {{\mathrm e}^{i \left (d x +c \right )} b^{3}}{2 d}-\frac {i {\mathrm e}^{i \left (d x +c \right )} a^{3}}{2 d}+\frac {3 i {\mathrm e}^{i \left (d x +c \right )} a \,b^{2}}{2 d}-\frac {3 \,{\mathrm e}^{-i \left (d x +c \right )} a^{2} b}{2 d}+\frac {{\mathrm e}^{-i \left (d x +c \right )} b^{3}}{2 d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )} a^{3}}{2 d}-\frac {3 i {\mathrm e}^{-i \left (d x +c \right )} a \,b^{2}}{2 d}+\frac {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 {3 a \,b^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{d}+\frac {3 a \,b^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{d}\) \(220\)
norman \(\frac {\frac {6 a^{2} b -4 b^{3}}{d}-\frac {6 a^{2} b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6}}{d}+\frac {2 \left (3 a^{2} b -4 b^{3}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}{d}-\frac {2 a \left (a^{2}-3 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}-\frac {2 a \left (a^{2}-3 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{d}+\frac {2 a \left (a^{2}-3 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{d}+\frac {2 a \left (a^{2}-3 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{7}}{d}-\frac {2 b \left (3 a^{2}+2 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}}{d}}{\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right ) \left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )^{3}}-\frac {3 a \,b^{2} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}+\frac {3 a \,b^{2} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}\) \(270\)

Input:

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

Output:

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

Fricas [A] (verification not implemented)

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

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

Output:

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

Sympy [F]

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

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

Output:

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

Maxima [A] (verification not implemented)

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

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

Output:

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

Giac [A] (verification not implemented)

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

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

Output:

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

Mupad [B] (verification not implemented)

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

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

Output:

(6*a*b^2*atanh(tan(c/2 + (d*x)/2)))/d - (tan(c/2 + (d*x)/2)^3*(6*a*b^2 - 2 
*a^3) - 6*a^2*b - tan(c/2 + (d*x)/2)*(6*a*b^2 - 2*a^3) + 4*b^3 + 6*a^2*b*t 
an(c/2 + (d*x)/2)^2)/(d*(tan(c/2 + (d*x)/2)^4 - 1))
 

Reduce [B] (verification not implemented)

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

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

Output:

( - 3*cos(c + d*x)*log(tan((c + d*x)/2) - 1)*a*b**2 + 3*cos(c + d*x)*log(t 
an((c + d*x)/2) + 1)*a*b**2 + cos(c + d*x)*sin(c + d*x)*a**3 - 3*cos(c + d 
*x)*sin(c + d*x)*a*b**2 + 3*cos(c + d*x)*a**2*b - 2*cos(c + d*x)*b**3 + 3* 
sin(c + d*x)**2*a**2*b - sin(c + d*x)**2*b**3 - 3*a**2*b + 2*b**3)/(cos(c 
+ d*x)*d)