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

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 = 21, antiderivative size = 114 \[ \int (a+b \cos (c+d x))^4 \sec ^2(c+d x) \, dx=\frac {1}{2} b^2 \left (12 a^2+b^2\right ) x+\frac {4 a^3 b \text {arctanh}(\sin (c+d x))}{d}-\frac {2 a b \left (a^2-2 b^2\right ) \sin (c+d x)}{d}-\frac {b^2 \left (2 a^2-b^2\right ) \cos (c+d x) \sin (c+d x)}{2 d}+\frac {a^2 (a+b \cos (c+d x))^2 \tan (c+d x)}{d} \] Output:

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

Mathematica [A] (verified)

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

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

Output:

(2*b*(b*(12*a^2 + b^2)*(c + d*x) - 8*a^3*Log[Cos[(c + d*x)/2] - Sin[(c + d 
*x)/2]] + 8*a^3*Log[Cos[(c + d*x)/2] + Sin[(c + d*x)/2]]) + 16*a*b^3*Sin[c 
 + d*x] + b^4*Sin[2*(c + d*x)] + 4*a^4*Tan[c + d*x])/(4*d)
 

Rubi [A] (verified)

Time = 0.82 (sec) , antiderivative size = 116, normalized size of antiderivative = 1.02, number of steps used = 10, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.476, Rules used = {3042, 3271, 3042, 3512, 3042, 3502, 3042, 3214, 3042, 4257}

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+b \cos (c+d x))^4 \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3271

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3512

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3502

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3214

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4257

\(\displaystyle -\frac {b^2 \left (2 a^2-b^2\right ) \sin (c+d x) \cos (c+d x)}{2 d}+\frac {a^2 \tan (c+d x) (a+b \cos (c+d x))^2}{d}+\frac {1}{2} \left (\frac {8 a^3 b \text {arctanh}(\sin (c+d x))}{d}-\frac {4 a b \left (a^2-2 b^2\right ) \sin (c+d x)}{d}+b^2 x \left (12 a^2+b^2\right )\right )\)

Input:

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

Output:

-1/2*(b^2*(2*a^2 - b^2)*Cos[c + d*x]*Sin[c + d*x])/d + (b^2*(12*a^2 + b^2) 
*x + (8*a^3*b*ArcTanh[Sin[c + d*x]])/d - (4*a*b*(a^2 - 2*b^2)*Sin[c + d*x] 
)/d)/2 + (a^2*(a + b*Cos[c + d*x])^2*Tan[c + d*x])/d
 

Defintions of rubi rules used

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3214
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_. 
)*(x_)]), x_Symbol] :> Simp[b*(x/d), x] - Simp[(b*c - a*d)/d   Int[1/(c + d 
*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]
 

rule 3271
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*sin[(e_.) + 
 (f_.)*(x_)])^(n_), x_Symbol] :> Simp[(-(b^2*c^2 - 2*a*b*c*d + a^2*d^2))*Co 
s[e + f*x]*(a + b*Sin[e + f*x])^(m - 2)*((c + d*Sin[e + f*x])^(n + 1)/(d*f* 
(n + 1)*(c^2 - d^2))), x] + Simp[1/(d*(n + 1)*(c^2 - d^2))   Int[(a + b*Sin 
[e + f*x])^(m - 3)*(c + d*Sin[e + f*x])^(n + 1)*Simp[b*(m - 2)*(b*c - a*d)^ 
2 + a*d*(n + 1)*(c*(a^2 + b^2) - 2*a*b*d) + (b*(n + 1)*(a*b*c^2 + c*d*(a^2 
+ b^2) - 3*a*b*d^2) - a*(n + 2)*(b*c - a*d)^2)*Sin[e + f*x] + b*(b^2*(c^2 - 
 d^2) - m*(b*c - a*d)^2 + d*n*(2*a*b*c - d*(a^2 + b^2)))*Sin[e + f*x]^2, x] 
, x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 - 
b^2, 0] && NeQ[c^2 - d^2, 0] && GtQ[m, 2] && LtQ[n, -1] && (IntegerQ[m] || 
IntegersQ[2*m, 2*n])
 

rule 3502
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*sin[(e_.) 
+ (f_.)*(x_)] + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[(-C)*Co 
s[e + f*x]*((a + b*Sin[e + f*x])^(m + 1)/(b*f*(m + 2))), x] + Simp[1/(b*(m 
+ 2))   Int[(a + b*Sin[e + f*x])^m*Simp[A*b*(m + 2) + b*C*(m + 1) + (b*B*(m 
 + 2) - a*C)*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, e, f, A, B, C, m}, x] 
 &&  !LtQ[m, -1]
 

rule 3512
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((c_) + (d_.)*sin[(e_.) + 
 (f_.)*(x_)])*((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)] + (C_.)*sin[(e_.) + (f 
_.)*(x_)]^2), x_Symbol] :> Simp[(-C)*d*Cos[e + f*x]*Sin[e + f*x]*((a + b*Si 
n[e + f*x])^(m + 1)/(b*f*(m + 3))), x] + Simp[1/(b*(m + 3))   Int[(a + b*Si 
n[e + f*x])^m*Simp[a*C*d + A*b*c*(m + 3) + b*(B*c*(m + 3) + d*(C*(m + 2) + 
A*(m + 3)))*Sin[e + f*x] - (2*a*C*d - b*(c*C + B*d)*(m + 3))*Sin[e + f*x]^2 
, x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C, m}, x] && NeQ[b*c - a*d, 
0] && NeQ[a^2 - b^2, 0] &&  !LtQ[m, -1]
 

rule 4257
Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] 
 /; FreeQ[{c, d}, x]
 
Maple [A] (verified)

Time = 13.48 (sec) , antiderivative size = 87, normalized size of antiderivative = 0.76

method result size
derivativedivides \(\frac {a^{4} \tan \left (d x +c \right )+4 a^{3} b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+6 a^{2} b^{2} \left (d x +c \right )+4 \sin \left (d x +c \right ) a \,b^{3}+b^{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}\) \(87\)
default \(\frac {a^{4} \tan \left (d x +c \right )+4 a^{3} b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+6 a^{2} b^{2} \left (d x +c \right )+4 \sin \left (d x +c \right ) a \,b^{3}+b^{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}\) \(87\)
parts \(\frac {a^{4} \tan \left (d x +c \right )}{d}+\frac {b^{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 {4 a^{3} b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}+\frac {6 a^{2} b^{2} \left (d x +c \right )}{d}+\frac {4 \sin \left (d x +c \right ) a \,b^{3}}{d}\) \(98\)
parallelrisch \(\frac {-32 \cos \left (d x +c \right ) a^{3} b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+32 \cos \left (d x +c \right ) a^{3} b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )+16 \sin \left (2 d x +2 c \right ) a \,b^{3}+\sin \left (3 d x +3 c \right ) b^{4}+48 d \,b^{2} x \left (a^{2}+\frac {b^{2}}{12}\right ) \cos \left (d x +c \right )+\sin \left (d x +c \right ) \left (8 a^{4}+b^{4}\right )}{8 d \cos \left (d x +c \right )}\) \(129\)
risch \(6 a^{2} b^{2} x +\frac {b^{4} x}{2}-\frac {i b^{4} {\mathrm e}^{2 i \left (d x +c \right )}}{8 d}-\frac {2 i a \,b^{3} {\mathrm e}^{i \left (d x +c \right )}}{d}+\frac {2 i a \,b^{3} {\mathrm e}^{-i \left (d x +c \right )}}{d}+\frac {i b^{4} {\mathrm e}^{-2 i \left (d x +c \right )}}{8 d}+\frac {2 i a^{4}}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}+\frac {4 a^{3} b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{d}-\frac {4 a^{3} b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{d}\) \(157\)
norman \(\frac {\left (-6 a^{2} b^{2}-\frac {1}{2} b^{4}\right ) x +\left (-18 a^{2} b^{2}-\frac {3}{2} b^{4}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+\left (6 a^{2} b^{2}+\frac {1}{2} b^{4}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{10}+\left (18 a^{2} b^{2}+\frac {3}{2} b^{4}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{8}+\left (-12 a^{2} b^{2}-b^{4}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+\left (12 a^{2} b^{2}+b^{4}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6}-\frac {2 \left (6 a^{4}-b^{4}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{d}-\frac {\left (2 a^{4}-8 a \,b^{3}+b^{4}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{9}}{d}-\frac {\left (2 a^{4}+8 a \,b^{3}+b^{4}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}-\frac {8 a \left (a^{3}-2 b^{3}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{7}}{d}-\frac {8 a \left (a^{3}+2 b^{3}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{d}}{\left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )^{4} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right )}-\frac {4 a^{3} b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}+\frac {4 a^{3} b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}\) \(364\)

Input:

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

Output:

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

Fricas [A] (verification not implemented)

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

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

Output:

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

Sympy [F]

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

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

Output:

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

Maxima [A] (verification not implemented)

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

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

Output:

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

Giac [A] (verification not implemented)

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

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

Output:

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

Mupad [B] (verification not implemented)

Time = 40.81 (sec) , antiderivative size = 150, normalized size of antiderivative = 1.32 \[ \int (a+b \cos (c+d x))^4 \sec ^2(c+d x) \, dx=\frac {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 )}{d}+\frac {a^4\,\sin \left (c+d\,x\right )}{d\,\cos \left (c+d\,x\right )}+\frac {12\,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 )}{d}+\frac {4\,a\,b^3\,\sin \left (c+d\,x\right )}{d}+\frac {b^4\,\cos \left (c+d\,x\right )\,\sin \left (c+d\,x\right )}{2\,d}+\frac {8\,a^3\,b\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d} \] Input:

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

Output:

(b^4*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d + (a^4*sin(c + d*x))/( 
d*cos(c + d*x)) + (12*a^2*b^2*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2))) 
/d + (4*a*b^3*sin(c + d*x))/d + (b^4*cos(c + d*x)*sin(c + d*x))/(2*d) + (8 
*a^3*b*atanh(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d
 

Reduce [B] (verification not implemented)

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

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

Output:

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