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

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 = 67 \[ \int \sec ^3(c+d x) (a \cos (c+d x)+b \sin (c+d x))^2 \, dx=\frac {a^2 \text {arctanh}(\sin (c+d x))}{d}-\frac {b^2 \text {arctanh}(\sin (c+d x))}{2 d}+\frac {2 a b \sec (c+d x)}{d}+\frac {b^2 \sec (c+d x) \tan (c+d x)}{2 d} \] Output:

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

Mathematica [A] (verified)

Time = 0.03 (sec) , antiderivative size = 67, normalized size of antiderivative = 1.00 \[ \int \sec ^3(c+d x) (a \cos (c+d x)+b \sin (c+d x))^2 \, dx=\frac {a^2 \coth ^{-1}(\sin (c+d x))}{d}-\frac {b^2 \text {arctanh}(\sin (c+d x))}{2 d}+\frac {2 a b \sec (c+d x)}{d}+\frac {b^2 \sec (c+d x) \tan (c+d x)}{2 d} \] Input:

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

Output:

(a^2*ArcCoth[Sin[c + d*x]])/d - (b^2*ArcTanh[Sin[c + d*x]])/(2*d) + (2*a*b 
*Sec[c + d*x])/d + (b^2*Sec[c + d*x]*Tan[c + d*x])/(2*d)
 

Rubi [A] (verified)

Time = 0.29 (sec) , antiderivative size = 67, 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 ^3(c+d x) (a \cos (c+d x)+b \sin (c+d x))^2 \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3569

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

\(\Big \downarrow \) 2009

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

Input:

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

Output:

(a^2*ArcTanh[Sin[c + d*x]])/d - (b^2*ArcTanh[Sin[c + d*x]])/(2*d) + (2*a*b 
*Sec[c + d*x])/d + (b^2*Sec[c + d*x]*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 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.38 (sec) , antiderivative size = 83, normalized size of antiderivative = 1.24

method result size
derivativedivides \(\frac {a^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+\frac {2 a b}{\cos \left (d x +c \right )}+b^{2} \left (\frac {\sin \left (d x +c \right )^{3}}{2 \cos \left (d x +c \right )^{2}}+\frac {\sin \left (d x +c \right )}{2}-\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )}{d}\) \(83\)
default \(\frac {a^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+\frac {2 a b}{\cos \left (d x +c \right )}+b^{2} \left (\frac {\sin \left (d x +c \right )^{3}}{2 \cos \left (d x +c \right )^{2}}+\frac {\sin \left (d x +c \right )}{2}-\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )}{d}\) \(83\)
parts \(\frac {a^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}+\frac {b^{2} \left (\frac {\sin \left (d x +c \right )^{3}}{2 \cos \left (d x +c \right )^{2}}+\frac {\sin \left (d x +c \right )}{2}-\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )}{d}+\frac {2 a b \sec \left (d x +c \right )}{d}\) \(86\)
parallelrisch \(\frac {-\left (a^{2}-\frac {b^{2}}{2}\right ) \left (1+\cos \left (2 d x +2 c \right )\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+\left (a^{2}-\frac {b^{2}}{2}\right ) \left (1+\cos \left (2 d x +2 c \right )\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )+4 \left (a \cos \left (d x +c \right )-\frac {a \cos \left (2 d x +2 c \right )}{2}+\frac {b \sin \left (d x +c \right )}{4}-\frac {a}{2}\right ) b}{d \left (1+\cos \left (2 d x +2 c \right )\right )}\) \(122\)
risch \(\frac {b \,{\mathrm e}^{i \left (d x +c \right )} \left (-i b \,{\mathrm e}^{2 i \left (d x +c \right )}+4 a \,{\mathrm e}^{2 i \left (d x +c \right )}+i b +4 a \right )}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{2}}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) a^{2}}{d}+\frac {b^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{2 d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) a^{2}}{d}-\frac {b^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{2 d}\) \(151\)
norman \(\frac {\frac {4 a b}{d}+\frac {b^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {b^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{7}}{d}+\frac {3 b^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{d}+\frac {3 b^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{d}-\frac {4 a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}}{d}+\frac {4 a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}{d}-\frac {4 a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6}}{d}}{\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right )^{2} \left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )^{2}}-\frac {\left (2 a^{2}-b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{2 d}+\frac {\left (2 a^{2}-b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{2 d}\) \(223\)

Input:

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

Output:

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

Fricas [A] (verification not implemented)

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

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

Output:

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

Sympy [F]

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

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

Output:

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

Maxima [A] (verification not implemented)

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

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

Output:

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

Giac [A] (verification not implemented)

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

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

Output:

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

Mupad [B] (verification not implemented)

Time = 17.05 (sec) , antiderivative size = 106, normalized size of antiderivative = 1.58 \[ \int \sec ^3(c+d x) (a \cos (c+d x)+b \sin (c+d x))^2 \, dx=\frac {b^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+b^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )-4\,a\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+4\,a\,b}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4-2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )}+\frac {\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )\,\left (2\,a^2-b^2\right )}{d} \] Input:

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

Output:

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

Reduce [B] (verification not implemented)

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

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

Output:

( - 4*cos(c + d*x)*a*b - 2*log(tan((c + d*x)/2) - 1)*sin(c + d*x)**2*a**2 
+ log(tan((c + d*x)/2) - 1)*sin(c + d*x)**2*b**2 + 2*log(tan((c + d*x)/2) 
- 1)*a**2 - log(tan((c + d*x)/2) - 1)*b**2 + 2*log(tan((c + d*x)/2) + 1)*s 
in(c + d*x)**2*a**2 - log(tan((c + d*x)/2) + 1)*sin(c + d*x)**2*b**2 - 2*l 
og(tan((c + d*x)/2) + 1)*a**2 + log(tan((c + d*x)/2) + 1)*b**2 - 4*sin(c + 
 d*x)**2*a*b - sin(c + d*x)*b**2 + 4*a*b)/(2*d*(sin(c + d*x)**2 - 1))