\(\int \frac {\cos ^2(c+d x) (A+B \cos (c+d x))}{(a+a \cos (c+d x))^2} \, dx\) [49]

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

Optimal result

Integrand size = 31, antiderivative size = 99 \[ \int \frac {\cos ^2(c+d x) (A+B \cos (c+d x))}{(a+a \cos (c+d x))^2} \, dx=\frac {(A-2 B) x}{a^2}-\frac {(A-4 B) \sin (c+d x)}{3 a^2 d}-\frac {(A-2 B) \sin (c+d x)}{a^2 d (1+\cos (c+d x))}+\frac {(A-B) \cos ^2(c+d x) \sin (c+d x)}{3 d (a+a \cos (c+d x))^2} \] Output:

(A-2*B)*x/a^2-1/3*(A-4*B)*sin(d*x+c)/a^2/d-(A-2*B)*sin(d*x+c)/a^2/d/(1+cos 
(d*x+c))+1/3*(A-B)*cos(d*x+c)^2*sin(d*x+c)/d/(a+a*cos(d*x+c))^2
 

Mathematica [A] (verified)

Time = 1.97 (sec) , antiderivative size = 137, normalized size of antiderivative = 1.38 \[ \int \frac {\cos ^2(c+d x) (A+B \cos (c+d x))}{(a+a \cos (c+d x))^2} \, dx=\frac {2 \cos \left (\frac {1}{2} (c+d x)\right ) \left ((A-B) \sec \left (\frac {c}{2}\right ) \sin \left (\frac {d x}{2}\right )-2 (5 A-8 B) \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 ) ((A-2 B) d x+B \sin (c+d x))+(A-B) \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[(Cos[c + d*x]^2*(A + B*Cos[c + d*x]))/(a + a*Cos[c + d*x])^2,x]
 

Output:

(2*Cos[(c + d*x)/2]*((A - B)*Sec[c/2]*Sin[(d*x)/2] - 2*(5*A - 8*B)*Cos[(c 
+ d*x)/2]^2*Sec[c/2]*Sin[(d*x)/2] + 6*Cos[(c + d*x)/2]^3*((A - 2*B)*d*x + 
B*Sin[c + d*x]) + (A - B)*Cos[(c + d*x)/2]*Tan[c/2]))/(3*a^2*d*(1 + Cos[c 
+ d*x])^2)
 

Rubi [A] (verified)

Time = 0.74 (sec) , antiderivative size = 100, normalized size of antiderivative = 1.01, number of steps used = 11, number of rules used = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.355, Rules used = {3042, 3456, 3042, 3447, 3042, 3502, 27, 3042, 3214, 3042, 3127}

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 {\cos ^2(c+d x) (A+B \cos (c+d x))}{(a \cos (c+d x)+a)^2} \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3456

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3447

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3502

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

\(\Big \downarrow \) 27

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3214

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3127

\(\displaystyle \frac {3 a (A-2 B) \left (\frac {x}{a}-\frac {\sin (c+d x)}{d (a \cos (c+d x)+a)}\right )-\frac {(A-4 B) \sin (c+d x)}{d}}{3 a^2}+\frac {(A-B) \sin (c+d x) \cos ^2(c+d x)}{3 d (a \cos (c+d x)+a)^2}\)

Input:

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

Output:

((A - B)*Cos[c + d*x]^2*Sin[c + d*x])/(3*d*(a + a*Cos[c + d*x])^2) + (-((( 
A - 4*B)*Sin[c + d*x])/d) + 3*a*(A - 2*B)*(x/a - Sin[c + d*x]/(d*(a + a*Co 
s[c + d*x]))))/(3*a^2)
 

Defintions of rubi rules used

rule 27
Int[(a_)*(Fx_), x_Symbol] :> Simp[a   Int[Fx, x], x] /; FreeQ[a, x] &&  !Ma 
tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
 

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

rule 3127
Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> Simp[-Cos[c + 
 d*x]/(d*(b + a*Sin[c + d*x])), x] /; FreeQ[{a, b, c, d}, x] && EqQ[a^2 - b 
^2, 0]
 

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 3447
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*sin[(e_.) 
+ (f_.)*(x_)])*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Int[(a 
 + b*Sin[e + f*x])^m*(A*c + (B*c + A*d)*Sin[e + f*x] + B*d*Sin[e + f*x]^2), 
 x] /; FreeQ[{a, b, c, d, e, f, A, B, m}, x] && NeQ[b*c - a*d, 0]
 

rule 3456
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[(A*b - a*B)*Cos[e + f*x]*(a + b*Sin[e + f*x])^m*((c + d*Sin[e + f*x])^n/( 
a*f*(2*m + 1))), x] - Simp[1/(a*b*(2*m + 1))   Int[(a + b*Sin[e + f*x])^(m 
+ 1)*(c + d*Sin[e + f*x])^(n - 1)*Simp[A*(a*d*n - b*c*(m + 1)) - B*(a*c*m + 
 b*d*n) - d*(a*B*(m - n) + A*b*(m + n + 1))*Sin[e + f*x], x], x], x] /; Fre 
eQ[{a, b, c, d, e, f, A, B}, 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] && (In 
tegerQ[2*n] || EqQ[c, 0])
 

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]
 
Maple [A] (verified)

Time = 1.18 (sec) , antiderivative size = 73, normalized size of antiderivative = 0.74

method result size
parallelrisch \(\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (-20 A +\sec \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} \left (3 B \cos \left (2 d x +2 c \right )+28 B \cos \left (d x +c \right )+2 A +23 B \right )\right )+12 d x \left (A -2 B \right )}{12 a^{2} d}\) \(73\)
derivativedivides \(\frac {\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} A}{3}-\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} B}{3}-3 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) A +5 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) B +\frac {4 B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}+4 \left (A -2 B \right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d \,a^{2}}\) \(106\)
default \(\frac {\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} A}{3}-\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} B}{3}-3 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) A +5 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) B +\frac {4 B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}+4 \left (A -2 B \right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d \,a^{2}}\) \(106\)
risch \(\frac {x A}{a^{2}}-\frac {2 B x}{a^{2}}-\frac {i {\mathrm e}^{i \left (d x +c \right )} B}{2 a^{2} d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )} B}{2 a^{2} d}-\frac {2 i \left (6 A \,{\mathrm e}^{2 i \left (d x +c \right )}-9 B \,{\mathrm e}^{2 i \left (d x +c \right )}+9 A \,{\mathrm e}^{i \left (d x +c \right )}-15 B \,{\mathrm e}^{i \left (d x +c \right )}+5 A -8 B \right )}{3 d \,a^{2} \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )^{3}}\) \(130\)
norman \(\frac {\frac {\left (A -2 B \right ) x}{a}+\frac {\left (A -2 B \right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6}}{a}-\frac {3 \left (A -3 B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 a d}-\frac {\left (A -2 B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{7}}{a d}+\frac {3 \left (A -2 B \right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}{a}+\frac {3 \left (A -2 B \right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}}{a}+\frac {\left (A -B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{9}}{6 a d}-\frac {\left (4 A -9 B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{a d}-\frac {\left (13 A -34 B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{3 a d}}{\left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )^{3} a}\) \(218\)

Input:

int(cos(d*x+c)^2*(A+B*cos(d*x+c))/(a+a*cos(d*x+c))^2,x,method=_RETURNVERBO 
SE)
 

Output:

1/12*(tan(1/2*d*x+1/2*c)*(-20*A+sec(1/2*d*x+1/2*c)^2*(3*B*cos(2*d*x+2*c)+2 
8*B*cos(d*x+c)+2*A+23*B))+12*d*x*(A-2*B))/a^2/d
 

Fricas [A] (verification not implemented)

Time = 0.08 (sec) , antiderivative size = 117, normalized size of antiderivative = 1.18 \[ \int \frac {\cos ^2(c+d x) (A+B \cos (c+d x))}{(a+a \cos (c+d x))^2} \, dx=\frac {3 \, {\left (A - 2 \, B\right )} d x \cos \left (d x + c\right )^{2} + 6 \, {\left (A - 2 \, B\right )} d x \cos \left (d x + c\right ) + 3 \, {\left (A - 2 \, B\right )} d x + {\left (3 \, B \cos \left (d x + c\right )^{2} - {\left (5 \, A - 14 \, B\right )} \cos \left (d x + c\right ) - 4 \, A + 10 \, B\right )} \sin \left (d x + c\right )}{3 \, {\left (a^{2} d \cos \left (d x + c\right )^{2} + 2 \, a^{2} d \cos \left (d x + c\right ) + a^{2} d\right )}} \] Input:

integrate(cos(d*x+c)^2*(A+B*cos(d*x+c))/(a+a*cos(d*x+c))^2,x, algorithm="f 
ricas")
 

Output:

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

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 411 vs. \(2 (90) = 180\).

Time = 1.18 (sec) , antiderivative size = 411, normalized size of antiderivative = 4.15 \[ \int \frac {\cos ^2(c+d x) (A+B \cos (c+d x))}{(a+a \cos (c+d x))^2} \, dx=\begin {cases} \frac {6 A d x \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} + \frac {6 A d x}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} + \frac {A \tan ^{5}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} - \frac {8 A \tan ^{3}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} - \frac {9 A \tan {\left (\frac {c}{2} + \frac {d x}{2} \right )}}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} - \frac {12 B d x \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} - \frac {12 B d x}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} - \frac {B \tan ^{5}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} + \frac {14 B \tan ^{3}{\left (\frac {c}{2} + \frac {d x}{2} \right )}}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} + \frac {27 B \tan {\left (\frac {c}{2} + \frac {d x}{2} \right )}}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} & \text {for}\: d \neq 0 \\\frac {x \left (A + B \cos {\left (c \right )}\right ) \cos ^{2}{\left (c \right )}}{\left (a \cos {\left (c \right )} + a\right )^{2}} & \text {otherwise} \end {cases} \] Input:

integrate(cos(d*x+c)**2*(A+B*cos(d*x+c))/(a+a*cos(d*x+c))**2,x)
 

Output:

Piecewise((6*A*d*x*tan(c/2 + d*x/2)**2/(6*a**2*d*tan(c/2 + d*x/2)**2 + 6*a 
**2*d) + 6*A*d*x/(6*a**2*d*tan(c/2 + d*x/2)**2 + 6*a**2*d) + A*tan(c/2 + d 
*x/2)**5/(6*a**2*d*tan(c/2 + d*x/2)**2 + 6*a**2*d) - 8*A*tan(c/2 + d*x/2)* 
*3/(6*a**2*d*tan(c/2 + d*x/2)**2 + 6*a**2*d) - 9*A*tan(c/2 + d*x/2)/(6*a** 
2*d*tan(c/2 + d*x/2)**2 + 6*a**2*d) - 12*B*d*x*tan(c/2 + d*x/2)**2/(6*a**2 
*d*tan(c/2 + d*x/2)**2 + 6*a**2*d) - 12*B*d*x/(6*a**2*d*tan(c/2 + d*x/2)** 
2 + 6*a**2*d) - B*tan(c/2 + d*x/2)**5/(6*a**2*d*tan(c/2 + d*x/2)**2 + 6*a* 
*2*d) + 14*B*tan(c/2 + d*x/2)**3/(6*a**2*d*tan(c/2 + d*x/2)**2 + 6*a**2*d) 
 + 27*B*tan(c/2 + d*x/2)/(6*a**2*d*tan(c/2 + d*x/2)**2 + 6*a**2*d), Ne(d, 
0)), (x*(A + B*cos(c))*cos(c)**2/(a*cos(c) + a)**2, True))
 

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 191 vs. \(2 (95) = 190\).

Time = 0.16 (sec) , antiderivative size = 191, normalized size of antiderivative = 1.93 \[ \int \frac {\cos ^2(c+d x) (A+B \cos (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 {24 \, \arctan \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 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 )} - A {\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 {12 \, \arctan \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a^{2}}\right )}}{6 \, d} \] Input:

integrate(cos(d*x+c)^2*(A+B*cos(d*x+c))/(a+a*cos(d*x+c))^2,x, algorithm="m 
axima")
 

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 - 24*arctan(sin(d*x + c)/(cos(d*x + c) + 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)) 
) - A*((9*sin(d*x + c)/(cos(d*x + c) + 1) - sin(d*x + c)^3/(cos(d*x + c) + 
 1)^3)/a^2 - 12*arctan(sin(d*x + c)/(cos(d*x + c) + 1))/a^2))/d
 

Giac [A] (verification not implemented)

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

integrate(cos(d*x+c)^2*(A+B*cos(d*x+c))/(a+a*cos(d*x+c))^2,x, algorithm="g 
iac")
 

Output:

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

Mupad [B] (verification not implemented)

Time = 41.98 (sec) , antiderivative size = 105, normalized size of antiderivative = 1.06 \[ \int \frac {\cos ^2(c+d x) (A+B \cos (c+d x))}{(a+a \cos (c+d x))^2} \, dx=\frac {x\,\left (A-2\,B\right )}{a^2}-\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (\frac {A-B}{a^2}+\frac {A-3\,B}{2\,a^2}\right )}{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 {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\,\left (A-B\right )}{6\,a^2\,d} \] Input:

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

Output:

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

Reduce [B] (verification not implemented)

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

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

Output:

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