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

Optimal result
Mathematica [B] (verified)
Rubi [A] (verified)
Maple [A] (verified)
Fricas [A] (verification not implemented)
Sympy [F(-1)]
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 = 119 \[ \int \sec ^2(c+d x) (a \cos (c+d x)+b \sin (c+d x))^4 \, dx=\frac {1}{2} \left (a^4+6 a^2 b^2-3 b^4\right ) x-\frac {4 a b^3 \log (\sin (c+d x))}{d}+\frac {4 a b^3 \log (\tan (c+d x))}{d}+\frac {\left (4 a b \left (a^2-b^2\right )+\left (a^4-6 a^2 b^2+b^4\right ) \cot (c+d x)\right ) \sin ^2(c+d x)}{2 d}+\frac {b^4 \tan (c+d x)}{d} \] Output:

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

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(263\) vs. \(2(119)=238\).

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

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

Output:

-1/2*((Sqrt[-b^2]*(a^2 + b^2)*((a^4 + 6*a^2*b^2 - 3*b^4 - 8*a*(-b^2)^(3/2) 
)*Log[Sqrt[-b^2] - b*Tan[c + d*x]] - (a^4 + 6*a^2*b^2 - 3*b^4 + 8*a*(-b^2) 
^(3/2))*Log[Sqrt[-b^2] + b*Tan[c + d*x]]))/2 - b^3*(-10*a^4 - 3*a^2*b^2 + 
3*b^4)*Tan[c + d*x] + 2*a*b^4*(5*a^2 + 2*b^2)*Tan[c + d*x]^2 + b^5*(5*a^2 
+ b^2)*Tan[c + d*x]^3 + a*b^6*Tan[c + d*x]^4 - b*Cos[c + d*x]^2*(b + a*Tan 
[c + d*x])*(a + b*Tan[c + d*x])^5)/(b*(a^2 + b^2)*d)
 

Rubi [A] (verified)

Time = 0.42 (sec) , antiderivative size = 129, normalized size of antiderivative = 1.08, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.214, Rules used = {3042, 3567, 532, 25, 2333, 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))^4 \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3567

\(\displaystyle -\frac {\int \frac {(b+a \cot (c+d x))^4 \tan ^2(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^4+8 a \cot (c+d x) b^3+\left (a^4+6 b^2 a^2-b^4\right ) \cot ^2(c+d x)\right ) \tan ^2(c+d x)}{\cot ^2(c+d x)+1}d\cot (c+d x)-\frac {4 a b \left (a^2-b^2\right )+\left (a^4-6 a^2 b^2+b^4\right ) \cot (c+d x)}{2 \left (\cot ^2(c+d x)+1\right )}}{d}\)

\(\Big \downarrow \) 25

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

\(\Big \downarrow \) 2333

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

\(\Big \downarrow \) 2009

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

Input:

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

Output:

-((-1/2*(4*a*b*(a^2 - b^2) + (a^4 - 6*a^2*b^2 + b^4)*Cot[c + d*x])/(1 + Co 
t[c + d*x]^2) + ((a^4 + 6*a^2*b^2 - 3*b^4)*ArcTan[Cot[c + d*x]] + 8*a*b^3* 
Log[Cot[c + d*x]] - 4*a*b^3*Log[1 + Cot[c + d*x]^2] - 2*b^4*Tan[c + d*x])/ 
2)/d)
 

Defintions of rubi rules used

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

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 2333
Int[(Pq_)*((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ 
ExpandIntegrand[(c*x)^m*Pq*(a + b*x^2)^p, x], x] /; FreeQ[{a, b, c, m}, x] 
&& PolyQ[Pq, x] && IGtQ[p, -2]
 

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.67 (sec) , antiderivative size = 155, normalized size of antiderivative = 1.30

method result size
derivativedivides \(\frac {a^{4} \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )-2 \cos \left (d x +c \right )^{2} a^{3} b +6 a^{2} 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 )+4 b^{3} a \left (-\frac {\sin \left (d x +c \right )^{2}}{2}-\ln \left (\cos \left (d x +c \right )\right )\right )+b^{4} \left (\frac {\sin \left (d x +c \right )^{5}}{\cos \left (d x +c \right )}+\left (\sin \left (d x +c \right )^{3}+\frac {3 \sin \left (d x +c \right )}{2}\right ) \cos \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )}{d}\) \(155\)
default \(\frac {a^{4} \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )-2 \cos \left (d x +c \right )^{2} a^{3} b +6 a^{2} 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 )+4 b^{3} a \left (-\frac {\sin \left (d x +c \right )^{2}}{2}-\ln \left (\cos \left (d x +c \right )\right )\right )+b^{4} \left (\frac {\sin \left (d x +c \right )^{5}}{\cos \left (d x +c \right )}+\left (\sin \left (d x +c \right )^{3}+\frac {3 \sin \left (d x +c \right )}{2}\right ) \cos \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )}{d}\) \(155\)
parts \(\frac {a^{4} \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^{4} \left (\frac {\sin \left (d x +c \right )^{5}}{\cos \left (d x +c \right )}+\left (\sin \left (d x +c \right )^{3}+\frac {3 \sin \left (d x +c \right )}{2}\right ) \cos \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )}{d}+\frac {4 b^{3} a \left (-\frac {\sin \left (d x +c \right )^{2}}{2}-\ln \left (\cos \left (d x +c \right )\right )\right )}{d}+\frac {6 a^{2} 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}-\frac {2 a^{3} b}{d \sec \left (d x +c \right )^{2}}\) \(166\)
parallelrisch \(\frac {32 \cos \left (d x +c \right ) b^{3} a \ln \left (\sec \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )-32 \cos \left (d x +c \right ) b^{3} a \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )-32 \cos \left (d x +c \right ) b^{3} a \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )+\left (a^{4}-6 a^{2} b^{2}+b^{4}\right ) \sin \left (3 d x +3 c \right )+4 \left (-a^{3} b +b^{3} a \right ) \cos \left (3 d x +3 c \right )+4 \left (a^{4} d x +6 a^{2} b^{2} d x -3 b^{4} d x +a^{3} b -b^{3} a \right ) \cos \left (d x +c \right )+\sin \left (d x +c \right ) \left (a^{2}-3 b^{2}\right )^{2}}{8 d \cos \left (d x +c \right )}\) \(196\)
risch \(-\frac {i {\mathrm e}^{2 i \left (d x +c \right )} a^{4}}{8 d}+\frac {a^{4} x}{2}+3 a^{2} b^{2} x -\frac {3 b^{4} x}{2}-\frac {{\mathrm e}^{2 i \left (d x +c \right )} a^{3} b}{2 d}+\frac {{\mathrm e}^{2 i \left (d x +c \right )} b^{3} a}{2 d}-\frac {i {\mathrm e}^{2 i \left (d x +c \right )} b^{4}}{8 d}-\frac {3 i {\mathrm e}^{-2 i \left (d x +c \right )} a^{2} b^{2}}{4 d}+4 i x \,b^{3} a -\frac {{\mathrm e}^{-2 i \left (d x +c \right )} a^{3} b}{2 d}+\frac {{\mathrm e}^{-2 i \left (d x +c \right )} b^{3} a}{2 d}+\frac {i {\mathrm e}^{-2 i \left (d x +c \right )} a^{4}}{8 d}+\frac {2 i b^{4}}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}+\frac {3 i {\mathrm e}^{2 i \left (d x +c \right )} a^{2} b^{2}}{4 d}+\frac {i {\mathrm e}^{-2 i \left (d x +c \right )} b^{4}}{8 d}+\frac {8 i b^{3} a c}{d}-\frac {4 b^{3} a \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d}\) \(271\)
norman \(\frac {\left (-\frac {1}{2} a^{4}-3 a^{2} b^{2}+\frac {3}{2} b^{4}\right ) x +\left (-\frac {3}{2} a^{4}-9 a^{2} b^{2}+\frac {9}{2} b^{4}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+\left (\frac {1}{2} a^{4}+3 a^{2} b^{2}-\frac {3}{2} b^{4}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{10}+\left (\frac {3}{2} a^{4}+9 a^{2} b^{2}-\frac {9}{2} b^{4}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{8}+\left (-a^{4}-6 a^{2} b^{2}+3 b^{4}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+\left (a^{4}+6 a^{2} b^{2}-3 b^{4}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6}+\frac {\left (8 a^{3} b -8 b^{3} a \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{8}}{d}-\frac {8 b^{4} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{d}-\frac {8 b^{4} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{7}}{d}+\frac {2 \left (a^{4}-6 a^{2} b^{2}-5 b^{4}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{d}-\frac {\left (a^{4}-6 a^{2} b^{2}+3 b^{4}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}-\frac {\left (a^{4}-6 a^{2} b^{2}+3 b^{4}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{9}}{d}-\frac {2 \left (4 a^{3} b -4 b^{3} a \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}}{d}+\frac {2 \left (4 a^{3} b -4 b^{3} a \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6}}{d}-\frac {\left (8 a^{3} b -8 b^{3} a \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}{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 )^{4}}-\frac {4 b^{3} a \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}-\frac {4 b^{3} a \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}+\frac {4 b^{3} a \ln \left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )}{d}\) \(528\)

Input:

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

Output:

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

Fricas [A] (verification not implemented)

Time = 0.09 (sec) , antiderivative size = 136, normalized size of antiderivative = 1.14 \[ \int \sec ^2(c+d x) (a \cos (c+d x)+b \sin (c+d x))^4 \, dx=-\frac {8 \, a b^{3} \cos \left (d x + c\right ) \log \left (-\cos \left (d x + c\right )\right ) + 4 \, {\left (a^{3} b - a b^{3}\right )} \cos \left (d x + c\right )^{3} - {\left (2 \, a^{3} b - 2 \, a b^{3} + {\left (a^{4} + 6 \, a^{2} b^{2} - 3 \, b^{4}\right )} d x\right )} \cos \left (d x + c\right ) - {\left (2 \, b^{4} + {\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} \cos \left (d x + c\right )^{2}\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))^4,x, algorithm="fricas" 
)
 

Output:

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

Sympy [F(-1)]

Timed out. \[ \int \sec ^2(c+d x) (a \cos (c+d x)+b \sin (c+d x))^4 \, dx=\text {Timed out} \] Input:

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

Output:

Timed out
 

Maxima [A] (verification not implemented)

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

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

Output:

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

Giac [A] (verification not implemented)

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

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

Output:

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

Mupad [B] (verification not implemented)

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

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

Output:

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

Reduce [B] (verification not implemented)

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

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

Output:

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