\(\int \frac {(B \cos (c+d x)+C \cos ^2(c+d x)) \sec ^3(c+d x)}{(a+a \cos (c+d x))^2} \, dx\) [267]

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

Optimal result

Integrand size = 40, antiderivative size = 107 \[ \int \frac {\left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec ^3(c+d x)}{(a+a \cos (c+d x))^2} \, dx=-\frac {(2 B-C) \text {arctanh}(\sin (c+d x))}{a^2 d}+\frac {2 (5 B-2 C) \tan (c+d x)}{3 a^2 d}-\frac {(2 B-C) \tan (c+d x)}{a^2 d (1+\cos (c+d x))}-\frac {(B-C) \tan (c+d x)}{3 d (a+a \cos (c+d x))^2} \] Output:

-(2*B-C)*arctanh(sin(d*x+c))/a^2/d+2/3*(5*B-2*C)*tan(d*x+c)/a^2/d-(2*B-C)* 
tan(d*x+c)/a^2/d/(1+cos(d*x+c))-1/3*(B-C)*tan(d*x+c)/d/(a+a*cos(d*x+c))^2
 

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(264\) vs. \(2(107)=214\).

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

Integrate[((B*Cos[c + d*x] + C*Cos[c + d*x]^2)*Sec[c + d*x]^3)/(a + a*Cos[ 
c + d*x])^2,x]
 

Output:

(2*Cos[(c + d*x)/2]*((B - C)*Sec[c/2]*Sin[(d*x)/2] + 2*(7*B - 4*C)*Cos[(c 
+ d*x)/2]^2*Sec[c/2]*Sin[(d*x)/2] + 6*Cos[(c + d*x)/2]^3*((2*B - C)*(Log[C 
os[(c + d*x)/2] - Sin[(c + d*x)/2]] - Log[Cos[(c + d*x)/2] + Sin[(c + d*x) 
/2]]) + (B*Sin[d*x])/((Cos[c/2] - Sin[c/2])*(Cos[c/2] + Sin[c/2])*(Cos[(c 
+ d*x)/2] - Sin[(c + d*x)/2])*(Cos[(c + d*x)/2] + Sin[(c + d*x)/2]))) + (B 
 - C)*Cos[(c + d*x)/2]*Tan[c/2]))/(3*a^2*d*(1 + Cos[c + d*x])^2)
 

Rubi [A] (verified)

Time = 0.94 (sec) , antiderivative size = 115, normalized size of antiderivative = 1.07, number of steps used = 13, number of rules used = 12, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.300, Rules used = {3042, 3508, 3042, 3457, 3042, 3457, 3042, 3227, 3042, 4254, 24, 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 \frac {\sec ^3(c+d x) \left (B \cos (c+d x)+C \cos ^2(c+d x)\right )}{(a \cos (c+d x)+a)^2} \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3508

\(\displaystyle \int \frac {\sec ^2(c+d x) (B+C \cos (c+d x))}{(a \cos (c+d x)+a)^2}dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3457

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3457

\(\displaystyle \frac {\frac {\int \left (2 a^2 (5 B-2 C)-3 a^2 (2 B-C) \cos (c+d x)\right ) \sec ^2(c+d x)dx}{a^2}-\frac {3 (2 B-C) \tan (c+d x)}{d (\cos (c+d x)+1)}}{3 a^2}-\frac {(B-C) \tan (c+d x)}{3 d (a \cos (c+d x)+a)^2}\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3227

\(\displaystyle \frac {\frac {2 a^2 (5 B-2 C) \int \sec ^2(c+d x)dx-3 a^2 (2 B-C) \int \sec (c+d x)dx}{a^2}-\frac {3 (2 B-C) \tan (c+d x)}{d (\cos (c+d x)+1)}}{3 a^2}-\frac {(B-C) \tan (c+d x)}{3 d (a \cos (c+d x)+a)^2}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\frac {2 a^2 (5 B-2 C) \int \csc \left (c+d x+\frac {\pi }{2}\right )^2dx-3 a^2 (2 B-C) \int \csc \left (c+d x+\frac {\pi }{2}\right )dx}{a^2}-\frac {3 (2 B-C) \tan (c+d x)}{d (\cos (c+d x)+1)}}{3 a^2}-\frac {(B-C) \tan (c+d x)}{3 d (a \cos (c+d x)+a)^2}\)

\(\Big \downarrow \) 4254

\(\displaystyle \frac {\frac {-\frac {2 a^2 (5 B-2 C) \int 1d(-\tan (c+d x))}{d}-3 a^2 (2 B-C) \int \csc \left (c+d x+\frac {\pi }{2}\right )dx}{a^2}-\frac {3 (2 B-C) \tan (c+d x)}{d (\cos (c+d x)+1)}}{3 a^2}-\frac {(B-C) \tan (c+d x)}{3 d (a \cos (c+d x)+a)^2}\)

\(\Big \downarrow \) 24

\(\displaystyle \frac {\frac {\frac {2 a^2 (5 B-2 C) \tan (c+d x)}{d}-3 a^2 (2 B-C) \int \csc \left (c+d x+\frac {\pi }{2}\right )dx}{a^2}-\frac {3 (2 B-C) \tan (c+d x)}{d (\cos (c+d x)+1)}}{3 a^2}-\frac {(B-C) \tan (c+d x)}{3 d (a \cos (c+d x)+a)^2}\)

\(\Big \downarrow \) 4257

\(\displaystyle \frac {\frac {\frac {2 a^2 (5 B-2 C) \tan (c+d x)}{d}-\frac {3 a^2 (2 B-C) \text {arctanh}(\sin (c+d x))}{d}}{a^2}-\frac {3 (2 B-C) \tan (c+d x)}{d (\cos (c+d x)+1)}}{3 a^2}-\frac {(B-C) \tan (c+d x)}{3 d (a \cos (c+d x)+a)^2}\)

Input:

Int[((B*Cos[c + d*x] + C*Cos[c + d*x]^2)*Sec[c + d*x]^3)/(a + a*Cos[c + d* 
x])^2,x]
 

Output:

-1/3*((B - C)*Tan[c + d*x])/(d*(a + a*Cos[c + d*x])^2) + ((-3*(2*B - C)*Ta 
n[c + d*x])/(d*(1 + Cos[c + d*x])) + ((-3*a^2*(2*B - C)*ArcTanh[Sin[c + d* 
x]])/d + (2*a^2*(5*B - 2*C)*Tan[c + d*x])/d)/a^2)/(3*a^2)
 

Defintions of rubi rules used

rule 24
Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]
 

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

rule 3227
Int[((b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*sin[(e_.) + (f_.)*(x 
_)]), x_Symbol] :> Simp[c   Int[(b*Sin[e + f*x])^m, x], x] + Simp[d/b   Int 
[(b*Sin[e + f*x])^(m + 1), x], x] /; FreeQ[{b, c, d, e, f, m}, x]
 

rule 3457
Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*sin[(e_.) + 
(f_.)*(x_)])*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Sim 
p[b*(A*b - a*B)*Cos[e + f*x]*(a + b*Sin[e + f*x])^m*((c + d*Sin[e + f*x])^( 
n + 1)/(a*f*(2*m + 1)*(b*c - a*d))), x] + Simp[1/(a*(2*m + 1)*(b*c - a*d)) 
  Int[(a + b*Sin[e + f*x])^(m + 1)*(c + d*Sin[e + f*x])^n*Simp[B*(a*c*m + b 
*d*(n + 1)) + A*(b*c*(m + 1) - a*d*(2*m + n + 2)) + d*(A*b - a*B)*(m + n + 
2)*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, n}, x] && NeQ 
[b*c - a*d, 0] && EqQ[a^2 - b^2, 0] && NeQ[c^2 - d^2, 0] && LtQ[m, -2^(-1)] 
 &&  !GtQ[n, 0] && IntegerQ[2*m] && (IntegerQ[2*n] || EqQ[c, 0])
 

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

rule 4254
Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Simp[-d^(-1)   Subst[Int[Exp 
andIntegrand[(1 + x^2)^(n/2 - 1), x], x], x, Cot[c + d*x]], x] /; FreeQ[{c, 
 d}, x] && IGtQ[n/2, 0]
 

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 = 0.46 (sec) , antiderivative size = 126, normalized size of antiderivative = 1.18

method result size
parallelrisch \(\frac {12 \left (B -\frac {C}{2}\right ) \cos \left (d x +c \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )-12 \left (B -\frac {C}{2}\right ) \cos \left (d x +c \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )+14 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (\left (\frac {5 B}{14}-\frac {C}{7}\right ) \cos \left (2 d x +2 c \right )+\left (B -\frac {5 C}{14}\right ) \cos \left (d x +c \right )+\frac {4 B}{7}-\frac {C}{7}\right ) \sec \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}{6 d \,a^{2} \cos \left (d x +c \right )}\) \(126\)
derivativedivides \(\frac {\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} B}{3}-\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} C}{3}+5 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) B -3 C \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+\left (4 B -2 C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )-\frac {2 B}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1}+\left (-4 B +2 C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-\frac {2 B}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1}}{2 d \,a^{2}}\) \(134\)
default \(\frac {\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} B}{3}-\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} C}{3}+5 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) B -3 C \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+\left (4 B -2 C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )-\frac {2 B}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1}+\left (-4 B +2 C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-\frac {2 B}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1}}{2 d \,a^{2}}\) \(134\)
risch \(\frac {2 i \left (6 B \,{\mathrm e}^{4 i \left (d x +c \right )}-3 C \,{\mathrm e}^{4 i \left (d x +c \right )}+18 B \,{\mathrm e}^{3 i \left (d x +c \right )}-9 C \,{\mathrm e}^{3 i \left (d x +c \right )}+22 B \,{\mathrm e}^{2 i \left (d x +c \right )}-7 C \,{\mathrm e}^{2 i \left (d x +c \right )}+24 B \,{\mathrm e}^{i \left (d x +c \right )}-9 C \,{\mathrm e}^{i \left (d x +c \right )}+10 B -4 C \right )}{3 a^{2} d \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )^{3} \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}+\frac {2 B \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{a^{2} d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) C}{a^{2} d}-\frac {2 B \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{a^{2} d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) C}{a^{2} d}\) \(227\)
norman \(\frac {\frac {\left (B -C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{11}}{6 a d}+\frac {3 \left (3 B -C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 a d}+\frac {\left (5 B -3 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{9}}{2 a d}-\frac {\left (7 B -3 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{a d}-\frac {\left (7 B -C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{7}}{3 a d}+\frac {\left (13 B -C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{6 a d}}{\left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right )^{2} a}+\frac {\left (2 B -C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{a^{2} d}-\frac {\left (2 B -C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{a^{2} d}\) \(242\)

Input:

int((B*cos(d*x+c)+C*cos(d*x+c)^2)*sec(d*x+c)^3/(a+a*cos(d*x+c))^2,x,method 
=_RETURNVERBOSE)
 

Output:

1/6*(12*(B-1/2*C)*cos(d*x+c)*ln(tan(1/2*d*x+1/2*c)-1)-12*(B-1/2*C)*cos(d*x 
+c)*ln(tan(1/2*d*x+1/2*c)+1)+14*tan(1/2*d*x+1/2*c)*((5/14*B-1/7*C)*cos(2*d 
*x+2*c)+(B-5/14*C)*cos(d*x+c)+4/7*B-1/7*C)*sec(1/2*d*x+1/2*c)^2)/d/a^2/cos 
(d*x+c)
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 207 vs. \(2 (103) = 206\).

Time = 0.09 (sec) , antiderivative size = 207, normalized size of antiderivative = 1.93 \[ \int \frac {\left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec ^3(c+d x)}{(a+a \cos (c+d x))^2} \, dx=-\frac {3 \, {\left ({\left (2 \, B - C\right )} \cos \left (d x + c\right )^{3} + 2 \, {\left (2 \, B - C\right )} \cos \left (d x + c\right )^{2} + {\left (2 \, B - C\right )} \cos \left (d x + c\right )\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \, {\left ({\left (2 \, B - C\right )} \cos \left (d x + c\right )^{3} + 2 \, {\left (2 \, B - C\right )} \cos \left (d x + c\right )^{2} + {\left (2 \, B - C\right )} \cos \left (d x + c\right )\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (2 \, {\left (5 \, B - 2 \, C\right )} \cos \left (d x + c\right )^{2} + {\left (14 \, B - 5 \, C\right )} \cos \left (d x + c\right ) + 3 \, B\right )} \sin \left (d x + c\right )}{6 \, {\left (a^{2} d \cos \left (d x + c\right )^{3} + 2 \, a^{2} d \cos \left (d x + c\right )^{2} + a^{2} d \cos \left (d x + c\right )\right )}} \] Input:

integrate((B*cos(d*x+c)+C*cos(d*x+c)^2)*sec(d*x+c)^3/(a+a*cos(d*x+c))^2,x, 
 algorithm="fricas")
 

Output:

-1/6*(3*((2*B - C)*cos(d*x + c)^3 + 2*(2*B - C)*cos(d*x + c)^2 + (2*B - C) 
*cos(d*x + c))*log(sin(d*x + c) + 1) - 3*((2*B - C)*cos(d*x + c)^3 + 2*(2* 
B - C)*cos(d*x + c)^2 + (2*B - C)*cos(d*x + c))*log(-sin(d*x + c) + 1) - 2 
*(2*(5*B - 2*C)*cos(d*x + c)^2 + (14*B - 5*C)*cos(d*x + c) + 3*B)*sin(d*x 
+ c))/(a^2*d*cos(d*x + c)^3 + 2*a^2*d*cos(d*x + c)^2 + a^2*d*cos(d*x + c))
 

Sympy [F]

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

integrate((B*cos(d*x+c)+C*cos(d*x+c)**2)*sec(d*x+c)**3/(a+a*cos(d*x+c))**2 
,x)
 

Output:

(Integral(B*cos(c + d*x)*sec(c + d*x)**3/(cos(c + d*x)**2 + 2*cos(c + d*x) 
 + 1), x) + Integral(C*cos(c + d*x)**2*sec(c + d*x)**3/(cos(c + d*x)**2 + 
2*cos(c + d*x) + 1), x))/a**2
 

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 244 vs. \(2 (103) = 206\).

Time = 0.05 (sec) , antiderivative size = 244, normalized size of antiderivative = 2.28 \[ \int \frac {\left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec ^3(c+d x)}{(a+a \cos (c+d x))^2} \, dx=\frac {B {\left (\frac {\frac {15 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {\sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}}{a^{2}} - \frac {12 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a^{2}} + \frac {12 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a^{2}} + \frac {12 \, \sin \left (d x + c\right )}{{\left (a^{2} - \frac {a^{2} \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}}\right )} {\left (\cos \left (d x + c\right ) + 1\right )}}\right )} - C {\left (\frac {\frac {9 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {\sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}}{a^{2}} - \frac {6 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a^{2}} + \frac {6 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a^{2}}\right )}}{6 \, d} \] Input:

integrate((B*cos(d*x+c)+C*cos(d*x+c)^2)*sec(d*x+c)^3/(a+a*cos(d*x+c))^2,x, 
 algorithm="maxima")
 

Output:

1/6*(B*((15*sin(d*x + c)/(cos(d*x + c) + 1) + sin(d*x + c)^3/(cos(d*x + c) 
 + 1)^3)/a^2 - 12*log(sin(d*x + c)/(cos(d*x + c) + 1) + 1)/a^2 + 12*log(si 
n(d*x + c)/(cos(d*x + c) + 1) - 1)/a^2 + 12*sin(d*x + c)/((a^2 - a^2*sin(d 
*x + c)^2/(cos(d*x + c) + 1)^2)*(cos(d*x + c) + 1))) - C*((9*sin(d*x + c)/ 
(cos(d*x + c) + 1) + sin(d*x + c)^3/(cos(d*x + c) + 1)^3)/a^2 - 6*log(sin( 
d*x + c)/(cos(d*x + c) + 1) + 1)/a^2 + 6*log(sin(d*x + c)/(cos(d*x + c) + 
1) - 1)/a^2))/d
 

Giac [A] (verification not implemented)

Time = 0.15 (sec) , antiderivative size = 155, normalized size of antiderivative = 1.45 \[ \int \frac {\left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec ^3(c+d x)}{(a+a \cos (c+d x))^2} \, dx=-\frac {\frac {6 \, {\left (2 \, B - C\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right )}{a^{2}} - \frac {6 \, {\left (2 \, B - C\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{a^{2}} + \frac {12 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )} a^{2}} - \frac {B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - C a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 15 \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 9 \, C a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a^{6}}}{6 \, d} \] Input:

integrate((B*cos(d*x+c)+C*cos(d*x+c)^2)*sec(d*x+c)^3/(a+a*cos(d*x+c))^2,x, 
 algorithm="giac")
 

Output:

-1/6*(6*(2*B - C)*log(abs(tan(1/2*d*x + 1/2*c) + 1))/a^2 - 6*(2*B - C)*log 
(abs(tan(1/2*d*x + 1/2*c) - 1))/a^2 + 12*B*tan(1/2*d*x + 1/2*c)/((tan(1/2* 
d*x + 1/2*c)^2 - 1)*a^2) - (B*a^4*tan(1/2*d*x + 1/2*c)^3 - C*a^4*tan(1/2*d 
*x + 1/2*c)^3 + 15*B*a^4*tan(1/2*d*x + 1/2*c) - 9*C*a^4*tan(1/2*d*x + 1/2* 
c))/a^6)/d
 

Mupad [B] (verification not implemented)

Time = 0.27 (sec) , antiderivative size = 123, normalized size of antiderivative = 1.15 \[ \int \frac {\left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec ^3(c+d x)}{(a+a \cos (c+d x))^2} \, dx=\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (\frac {B-C}{a^2}+\frac {3\,B-C}{2\,a^2}\right )}{d}+\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\,\left (B-C\right )}{6\,a^2\,d}-\frac {2\,B\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left (a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2-a^2\right )}-\frac {2\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )\,\left (2\,B-C\right )}{a^2\,d} \] Input:

int((B*cos(c + d*x) + C*cos(c + d*x)^2)/(cos(c + d*x)^3*(a + a*cos(c + d*x 
))^2),x)
 

Output:

(tan(c/2 + (d*x)/2)*((B - C)/a^2 + (3*B - C)/(2*a^2)))/d + (tan(c/2 + (d*x 
)/2)^3*(B - C))/(6*a^2*d) - (2*B*tan(c/2 + (d*x)/2))/(d*(a^2*tan(c/2 + (d* 
x)/2)^2 - a^2)) - (2*atanh(tan(c/2 + (d*x)/2))*(2*B - C))/(a^2*d)
 

Reduce [B] (verification not implemented)

Time = 0.17 (sec) , antiderivative size = 267, normalized size of antiderivative = 2.50 \[ \int \frac {\left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec ^3(c+d x)}{(a+a \cos (c+d x))^2} \, dx=\frac {12 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} b -6 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} c -12 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) b +6 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right ) c -12 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} b +6 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} c +12 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) b -6 \,\mathrm {log}\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right ) c +\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5} b -\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5} c +14 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} b -8 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} c -27 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) b +9 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) c}{6 a^{2} d \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right )} \] Input:

int((B*cos(d*x+c)+C*cos(d*x+c)^2)*sec(d*x+c)^3/(a+a*cos(d*x+c))^2,x)
 

Output:

(12*log(tan((c + d*x)/2) - 1)*tan((c + d*x)/2)**2*b - 6*log(tan((c + d*x)/ 
2) - 1)*tan((c + d*x)/2)**2*c - 12*log(tan((c + d*x)/2) - 1)*b + 6*log(tan 
((c + d*x)/2) - 1)*c - 12*log(tan((c + d*x)/2) + 1)*tan((c + d*x)/2)**2*b 
+ 6*log(tan((c + d*x)/2) + 1)*tan((c + d*x)/2)**2*c + 12*log(tan((c + d*x) 
/2) + 1)*b - 6*log(tan((c + d*x)/2) + 1)*c + tan((c + d*x)/2)**5*b - tan(( 
c + d*x)/2)**5*c + 14*tan((c + d*x)/2)**3*b - 8*tan((c + d*x)/2)**3*c - 27 
*tan((c + d*x)/2)*b + 9*tan((c + d*x)/2)*c)/(6*a**2*d*(tan((c + d*x)/2)**2 
 - 1))