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

Optimal result
Mathematica [B] (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 = 26, antiderivative size = 91 \[ \int \sec (c+d x) (a \cos (c+d x)+b \sin (c+d x))^3 \, dx=\frac {1}{2} a \left (a^2+3 b^2\right ) x-\frac {b^3 \log (\sin (c+d x))}{d}+\frac {b^3 \log (\tan (c+d x))}{d}+\frac {\left (b \left (3 a^2-b^2\right )+a \left (a^2-3 b^2\right ) \cot (c+d x)\right ) \sin ^2(c+d x)}{2 d} \] Output:

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

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(401\) vs. \(2(91)=182\).

Time = 0.55 (sec) , antiderivative size = 401, normalized size of antiderivative = 4.41 \[ \int \sec (c+d x) (a \cos (c+d x)+b \sin (c+d x))^3 \, dx=\frac {5 a^4 b^2+2 a^2 b^4-b^6+\left (-3 a^4 b^2-2 a^2 b^4+b^6\right ) \cos (2 (c+d x))+2 a^2 b^4 \log \left (\sqrt {-b^2}-b \tan (c+d x)\right )+2 b^6 \log \left (\sqrt {-b^2}-b \tan (c+d x)\right )-a^5 \sqrt {-b^2} \log \left (\sqrt {-b^2}-b \tan (c+d x)\right )+4 a^3 \left (-b^2\right )^{3/2} \log \left (\sqrt {-b^2}-b \tan (c+d x)\right )-3 a \left (-b^2\right )^{5/2} \log \left (\sqrt {-b^2}-b \tan (c+d x)\right )+2 a^2 b^4 \log \left (\sqrt {-b^2}+b \tan (c+d x)\right )+2 b^6 \log \left (\sqrt {-b^2}+b \tan (c+d x)\right )+a^5 \sqrt {-b^2} \log \left (\sqrt {-b^2}+b \tan (c+d x)\right )+3 a b^4 \sqrt {-b^2} \log \left (\sqrt {-b^2}+b \tan (c+d x)\right )-4 a^3 \left (-b^2\right )^{3/2} \log \left (\sqrt {-b^2}+b \tan (c+d x)\right )+a b \left (a^4-2 a^2 b^2-3 b^4\right ) \sin (2 (c+d x))}{4 b \left (a^2+b^2\right ) d} \] Input:

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

Output:

(5*a^4*b^2 + 2*a^2*b^4 - b^6 + (-3*a^4*b^2 - 2*a^2*b^4 + b^6)*Cos[2*(c + d 
*x)] + 2*a^2*b^4*Log[Sqrt[-b^2] - b*Tan[c + d*x]] + 2*b^6*Log[Sqrt[-b^2] - 
 b*Tan[c + d*x]] - a^5*Sqrt[-b^2]*Log[Sqrt[-b^2] - b*Tan[c + d*x]] + 4*a^3 
*(-b^2)^(3/2)*Log[Sqrt[-b^2] - b*Tan[c + d*x]] - 3*a*(-b^2)^(5/2)*Log[Sqrt 
[-b^2] - b*Tan[c + d*x]] + 2*a^2*b^4*Log[Sqrt[-b^2] + b*Tan[c + d*x]] + 2* 
b^6*Log[Sqrt[-b^2] + b*Tan[c + d*x]] + a^5*Sqrt[-b^2]*Log[Sqrt[-b^2] + b*T 
an[c + d*x]] + 3*a*b^4*Sqrt[-b^2]*Log[Sqrt[-b^2] + b*Tan[c + d*x]] - 4*a^3 
*(-b^2)^(3/2)*Log[Sqrt[-b^2] + b*Tan[c + d*x]] + a*b*(a^4 - 2*a^2*b^2 - 3* 
b^4)*Sin[2*(c + d*x)])/(4*b*(a^2 + b^2)*d)
 

Rubi [A] (verified)

Time = 0.31 (sec) , antiderivative size = 104, normalized size of antiderivative = 1.14, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.231, Rules used = {3042, 3567, 532, 25, 523, 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 (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)}dx\)

\(\Big \downarrow \) 3567

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

\(\Big \downarrow \) 532

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

\(\Big \downarrow \) 25

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

\(\Big \downarrow \) 523

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

\(\Big \downarrow \) 2009

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

Input:

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

Output:

-((-1/2*(b*(3*a^2 - b^2) + a*(a^2 - 3*b^2)*Cot[c + d*x])/(1 + Cot[c + d*x] 
^2) + (a*(a^2 + 3*b^2)*ArcTan[Cot[c + d*x]] + 2*b^3*Log[Cot[c + d*x]] - b^ 
3*Log[1 + Cot[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 523
Int[((x_)^(m_.)*((c_) + (d_.)*(x_)))/((a_) + (b_.)*(x_)^2), x_Symbol] :> In 
t[ExpandIntegrand[x^m*((c + d*x)/(a + b*x^2)), x], x] /; FreeQ[{a, b, c, d} 
, x] && IntegerQ[m]
 

rule 532
Int[(x_)^(m_)*((c_) + (d_.)*(x_))^(n_.)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbo 
l] :> With[{Qx = PolynomialQuotient[x^m*(c + d*x)^n, a + b*x^2, x], e = Coe 
ff[PolynomialRemainder[x^m*(c + d*x)^n, a + b*x^2, x], x, 0], f = Coeff[Pol 
ynomialRemainder[x^m*(c + d*x)^n, a + b*x^2, x], x, 1]}, Simp[(a*f - b*e*x) 
*((a + b*x^2)^(p + 1)/(2*a*b*(p + 1))), x] + Simp[1/(2*a*(p + 1))   Int[x^m 
*(a + b*x^2)^(p + 1)*ExpandToSum[2*a*(p + 1)*(Qx/x^m) + e*((2*p + 3)/x^m), 
x], x], x]] /; FreeQ[{a, b, c, d}, x] && IGtQ[n, 0] && ILtQ[m, 0] && LtQ[p, 
 -1] && IntegerQ[2*p]
 

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 3567
Int[cos[(c_.) + (d_.)*(x_)]^(m_.)*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*si 
n[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[-d^(-1)   Subst[Int[x^m*((b 
+ a*x)^n/(1 + x^2)^((m + n + 2)/2)), x], x, Cot[c + d*x]], x] /; FreeQ[{a, 
b, c, d}, x] && IntegerQ[n] && IntegerQ[(m + n)/2] && NeQ[n, -1] &&  !(GtQ[ 
n, 0] && GtQ[m, 1])
 
Maple [A] (verified)

Time = 0.43 (sec) , antiderivative size = 98, normalized size of antiderivative = 1.08

method result size
derivativedivides \(\frac {a^{3} \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )-\frac {3 a^{2} b \cos \left (d x +c \right )^{2}}{2}+3 a \,b^{2} \left (-\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+b^{3} \left (-\frac {\sin \left (d x +c \right )^{2}}{2}-\ln \left (\cos \left (d x +c \right )\right )\right )}{d}\) \(98\)
default \(\frac {a^{3} \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )-\frac {3 a^{2} b \cos \left (d x +c \right )^{2}}{2}+3 a \,b^{2} \left (-\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+b^{3} \left (-\frac {\sin \left (d x +c \right )^{2}}{2}-\ln \left (\cos \left (d x +c \right )\right )\right )}{d}\) \(98\)
parts \(\frac {a^{3} \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {b^{3} \left (-\frac {\sin \left (d x +c \right )^{2}}{2}-\ln \left (\cos \left (d x +c \right )\right )\right )}{d}-\frac {3 a^{2} b}{2 d \sec \left (d x +c \right )^{2}}+\frac {3 a \,b^{2} \left (-\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) \(106\)
parallelrisch \(\frac {4 b^{3} \ln \left (\sec \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )-4 b^{3} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )-4 b^{3} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )+\left (-3 a^{2} b +b^{3}\right ) \cos \left (2 d x +2 c \right )+\left (a^{3}-3 a \,b^{2}\right ) \sin \left (2 d x +2 c \right )+2 a^{3} d x +6 a \,b^{2} d x +3 a^{2} b -b^{3}}{4 d}\) \(124\)
risch \(i x \,b^{3}+\frac {a^{3} x}{2}+\frac {3 a \,b^{2} x}{2}-\frac {3 \,{\mathrm e}^{2 i \left (d x +c \right )} a^{2} b}{8 d}+\frac {{\mathrm e}^{2 i \left (d x +c \right )} b^{3}}{8 d}-\frac {i {\mathrm e}^{2 i \left (d x +c \right )} a^{3}}{8 d}+\frac {3 i {\mathrm e}^{2 i \left (d x +c \right )} a \,b^{2}}{8 d}-\frac {3 \,{\mathrm e}^{-2 i \left (d x +c \right )} a^{2} b}{8 d}+\frac {{\mathrm e}^{-2 i \left (d x +c \right )} b^{3}}{8 d}+\frac {i {\mathrm e}^{-2 i \left (d x +c \right )} a^{3}}{8 d}-\frac {3 i {\mathrm e}^{-2 i \left (d x +c \right )} a \,b^{2}}{8 d}+\frac {2 i b^{3} c}{d}-\frac {b^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d}\) \(196\)
norman \(\frac {\left (\frac {1}{2} a^{3}+\frac {3}{2} a \,b^{2}\right ) x +\left (\frac {1}{2} a^{3}+\frac {3}{2} a \,b^{2}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6}+\left (\frac {3}{2} a^{3}+\frac {9}{2} a \,b^{2}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+\left (\frac {3}{2} a^{3}+\frac {9}{2} a \,b^{2}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+\frac {\left (6 a^{2} b -2 b^{3}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}{d}+\frac {\left (6 a^{2} b -2 b^{3}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}}{d}+\frac {a \left (a^{2}-3 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}-\frac {a \left (a^{2}-3 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{d}}{\left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )^{3}}+\frac {b^{3} \ln \left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )}{d}-\frac {b^{3} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}-\frac {b^{3} \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}\) \(272\)

Input:

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

Output:

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

Fricas [A] (verification not implemented)

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

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

Output:

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

Sympy [F]

\[ \int \sec (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 {\left (c + d x \right )}\, dx \] Input:

integrate(sec(d*x+c)*(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), x)
 

Maxima [A] (verification not implemented)

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

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

Output:

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

Giac [A] (verification not implemented)

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

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

Output:

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

Mupad [B] (verification not implemented)

Time = 17.41 (sec) , antiderivative size = 156, normalized size of antiderivative = 1.71 \[ \int \sec (c+d x) (a \cos (c+d x)+b \sin (c+d x))^3 \, dx=\frac {b^3\,\ln \left (\frac {1}{{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}\right )-b^3\,\ln \left (\frac {\cos \left (c+d\,x\right )}{\cos \left (c+d\,x\right )+1}\right )+a^3\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )+\frac {b^3\,\cos \left (2\,c+2\,d\,x\right )}{4}+\frac {a^3\,\sin \left (2\,c+2\,d\,x\right )}{4}+3\,a\,b^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )-\frac {3\,a^2\,b\,\cos \left (2\,c+2\,d\,x\right )}{4}-\frac {3\,a\,b^2\,\sin \left (2\,c+2\,d\,x\right )}{4}}{d} \] Input:

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

Output:

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

Reduce [B] (verification not implemented)

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

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

Output:

(cos(c + d*x)*sin(c + d*x)*a**3 - 3*cos(c + d*x)*sin(c + d*x)*a*b**2 + 2*l 
og(tan((c + d*x)/2)**2 + 1)*b**3 - 2*log(tan((c + d*x)/2) - 1)*b**3 - 2*lo 
g(tan((c + d*x)/2) + 1)*b**3 + 3*sin(c + d*x)**2*a**2*b - sin(c + d*x)**2* 
b**3 + a**3*c + a**3*d*x + 3*a*b**2*c + 3*a*b**2*d*x)/(2*d)