Integrand size = 39, antiderivative size = 103 \[ \int \frac {\cos (c+d x) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right )}{(a+a \cos (c+d x))^2} \, dx=\frac {(B-2 C) x}{a^2}+\frac {(A-B+4 C) \sin (c+d x)}{3 a^2 d}-\frac {(B-2 C) \sin (c+d x)}{a^2 d (1+\cos (c+d x))}-\frac {(A-B+C) \cos ^2(c+d x) \sin (c+d x)}{3 d (a+a \cos (c+d x))^2} \] Output:
(B-2*C)*x/a^2+1/3*(A-B+4*C)*sin(d*x+c)/a^2/d-(B-2*C)*sin(d*x+c)/a^2/d/(1+c os(d*x+c))-1/3*(A-B+C)*cos(d*x+c)^2*sin(d*x+c)/d/(a+a*cos(d*x+c))^2
Leaf count is larger than twice the leaf count of optimal. \(275\) vs. \(2(103)=206\).
Time = 2.09 (sec) , antiderivative size = 275, normalized size of antiderivative = 2.67 \[ \int \frac {\cos (c+d x) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right )}{(a+a \cos (c+d x))^2} \, dx=\frac {\cos \left (\frac {1}{2} (c+d x)\right ) \sec \left (\frac {c}{2}\right ) \left (18 (B-2 C) d x \cos \left (\frac {d x}{2}\right )+18 (B-2 C) d x \cos \left (c+\frac {d x}{2}\right )+6 B d x \cos \left (c+\frac {3 d x}{2}\right )-12 C d x \cos \left (c+\frac {3 d x}{2}\right )+6 B d x \cos \left (2 c+\frac {3 d x}{2}\right )-12 C d x \cos \left (2 c+\frac {3 d x}{2}\right )+12 A \sin \left (\frac {d x}{2}\right )-36 B \sin \left (\frac {d x}{2}\right )+66 C \sin \left (\frac {d x}{2}\right )-12 A \sin \left (c+\frac {d x}{2}\right )+24 B \sin \left (c+\frac {d x}{2}\right )-30 C \sin \left (c+\frac {d x}{2}\right )+8 A \sin \left (c+\frac {3 d x}{2}\right )-20 B \sin \left (c+\frac {3 d x}{2}\right )+41 C \sin \left (c+\frac {3 d x}{2}\right )+9 C \sin \left (2 c+\frac {3 d x}{2}\right )+3 C \sin \left (2 c+\frac {5 d x}{2}\right )+3 C \sin \left (3 c+\frac {5 d x}{2}\right )\right )}{12 a^2 d (1+\cos (c+d x))^2} \] Input:
Integrate[(Cos[c + d*x]*(A + B*Cos[c + d*x] + C*Cos[c + d*x]^2))/(a + a*Co s[c + d*x])^2,x]
Output:
(Cos[(c + d*x)/2]*Sec[c/2]*(18*(B - 2*C)*d*x*Cos[(d*x)/2] + 18*(B - 2*C)*d *x*Cos[c + (d*x)/2] + 6*B*d*x*Cos[c + (3*d*x)/2] - 12*C*d*x*Cos[c + (3*d*x )/2] + 6*B*d*x*Cos[2*c + (3*d*x)/2] - 12*C*d*x*Cos[2*c + (3*d*x)/2] + 12*A *Sin[(d*x)/2] - 36*B*Sin[(d*x)/2] + 66*C*Sin[(d*x)/2] - 12*A*Sin[c + (d*x) /2] + 24*B*Sin[c + (d*x)/2] - 30*C*Sin[c + (d*x)/2] + 8*A*Sin[c + (3*d*x)/ 2] - 20*B*Sin[c + (3*d*x)/2] + 41*C*Sin[c + (3*d*x)/2] + 9*C*Sin[2*c + (3* d*x)/2] + 3*C*Sin[2*c + (5*d*x)/2] + 3*C*Sin[3*c + (5*d*x)/2]))/(12*a^2*d* (1 + Cos[c + d*x])^2)
Time = 0.79 (sec) , antiderivative size = 103, normalized size of antiderivative = 1.00, number of steps used = 11, number of rules used = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.282, Rules used = {3042, 3520, 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 (c+d x) \left (A+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 {\sin \left (c+d x+\frac {\pi }{2}\right ) \left (A+B \sin \left (c+d x+\frac {\pi }{2}\right )+C \sin \left (c+d x+\frac {\pi }{2}\right )^2\right )}{\left (a \sin \left (c+d x+\frac {\pi }{2}\right )+a\right )^2}dx\) |
\(\Big \downarrow \) 3520 |
\(\displaystyle \frac {\int \frac {\cos (c+d x) (a (A+2 B-2 C)+a (A-B+4 C) \cos (c+d x))}{\cos (c+d x) a+a}dx}{3 a^2}-\frac {(A-B+C) \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 (a (A+2 B-2 C)+a (A-B+4 C) \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+C) \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 {a (A-B+4 C) \cos ^2(c+d x)+a (A+2 B-2 C) \cos (c+d x)}{\cos (c+d x) a+a}dx}{3 a^2}-\frac {(A-B+C) \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 {a (A-B+4 C) \sin \left (c+d x+\frac {\pi }{2}\right )^2+a (A+2 B-2 C) \sin \left (c+d x+\frac {\pi }{2}\right )}{\sin \left (c+d x+\frac {\pi }{2}\right ) a+a}dx}{3 a^2}-\frac {(A-B+C) \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 (B-2 C) \cos (c+d x)}{\cos (c+d x) a+a}dx}{a}+\frac {(A-B+4 C) \sin (c+d x)}{d}}{3 a^2}-\frac {(A-B+C) \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 (B-2 C) \int \frac {\cos (c+d x)}{\cos (c+d x) a+a}dx+\frac {(A-B+4 C) \sin (c+d x)}{d}}{3 a^2}-\frac {(A-B+C) \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 (B-2 C) \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-B+4 C) \sin (c+d x)}{d}}{3 a^2}-\frac {(A-B+C) \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 (B-2 C) \left (\frac {x}{a}-\int \frac {1}{\cos (c+d x) a+a}dx\right )+\frac {(A-B+4 C) \sin (c+d x)}{d}}{3 a^2}-\frac {(A-B+C) \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 (B-2 C) \left (\frac {x}{a}-\int \frac {1}{\sin \left (c+d x+\frac {\pi }{2}\right ) a+a}dx\right )+\frac {(A-B+4 C) \sin (c+d x)}{d}}{3 a^2}-\frac {(A-B+C) \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 (B-2 C) \left (\frac {x}{a}-\frac {\sin (c+d x)}{d (a \cos (c+d x)+a)}\right )+\frac {(A-B+4 C) \sin (c+d x)}{d}}{3 a^2}-\frac {(A-B+C) \sin (c+d x) \cos ^2(c+d x)}{3 d (a \cos (c+d x)+a)^2}\) |
Input:
Int[(Cos[c + d*x]*(A + B*Cos[c + d*x] + C*Cos[c + d*x]^2))/(a + a*Cos[c + d*x])^2,x]
Output:
-1/3*((A - B + C)*Cos[c + d*x]^2*Sin[c + d*x])/(d*(a + a*Cos[c + d*x])^2) + (((A - B + 4*C)*Sin[c + d*x])/d + 3*a*(B - 2*C)*(x/a - Sin[c + d*x]/(d*( a + a*Cos[c + d*x]))))/(3*a^2)
Int[(a_)*(Fx_), x_Symbol] :> Simp[a Int[Fx, x], x] /; FreeQ[a, x] && !Ma tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
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]
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]
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]
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]
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[(a*A - b*B + a*C)*Cos[e + f*x]*(a + b* Sin[e + f*x])^m*((c + d*Sin[e + f*x])^(n + 1)/(f*(b*c - a*d)*(2*m + 1))), x ] + Simp[1/(b*(b*c - a*d)*(2*m + 1)) Int[(a + b*Sin[e + f*x])^(m + 1)*(c + d*Sin[e + f*x])^n*Simp[A*(a*c*(m + 1) - b*d*(2*m + n + 2)) + B*(b*c*m + a *d*(n + 1)) - C*(a*c*m + b*d*(n + 1)) + (d*(a*A - b*B)*(m + n + 2) + C*(b*c *(2*m + 1) - a*d*(m - n - 1)))*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C, n}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 - b^2, 0] && NeQ[c ^2 - d^2, 0] && LtQ[m, -2^(-1)]
Time = 0.34 (sec) , antiderivative size = 79, normalized size of antiderivative = 0.77
method | result | size |
parallelrisch | \(\frac {\left (8 A -20 B +\sec \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} \left (3 C \cos \left (2 d x +2 c \right )+28 \cos \left (d x +c \right ) C -2 A +2 B +23 C \right )\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+12 d x \left (B -2 C \right )}{12 a^{2} d}\) | \(79\) |
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}-\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} C}{3}+A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-3 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) B +5 C \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+\frac {4 C \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}+4 \left (B -2 C \right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d \,a^{2}}\) | \(131\) |
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}-\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} C}{3}+A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-3 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) B +5 C \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+\frac {4 C \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}+4 \left (B -2 C \right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d \,a^{2}}\) | \(131\) |
risch | \(\frac {x B}{a^{2}}-\frac {2 C x}{a^{2}}-\frac {i {\mathrm e}^{i \left (d x +c \right )} C}{2 a^{2} d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )} C}{2 a^{2} d}+\frac {2 i \left (3 A \,{\mathrm e}^{2 i \left (d x +c \right )}-6 B \,{\mathrm e}^{2 i \left (d x +c \right )}+9 C \,{\mathrm e}^{2 i \left (d x +c \right )}+3 A \,{\mathrm e}^{i \left (d x +c \right )}-9 B \,{\mathrm e}^{i \left (d x +c \right )}+15 C \,{\mathrm e}^{i \left (d x +c \right )}+2 A -5 B +8 C \right )}{3 d \,a^{2} \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )^{3}}\) | \(157\) |
norman | \(\frac {\frac {\left (B -2 C \right ) x}{a}+\frac {\left (B -2 C \right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6}}{a}+\frac {\left (A -4 B +9 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{a d}-\frac {\left (B -2 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{7}}{a d}+\frac {3 \left (B -2 C \right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}{a}+\frac {3 \left (B -2 C \right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}}{a}+\frac {\left (A -3 B +9 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 a d}-\frac {\left (A -B +C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{9}}{6 a d}+\frac {\left (4 A -13 B +34 C \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}\) | \(225\) |
Input:
int(cos(d*x+c)*(A+B*cos(d*x+c)+C*cos(d*x+c)^2)/(a+a*cos(d*x+c))^2,x,method =_RETURNVERBOSE)
Output:
1/12*((8*A-20*B+sec(1/2*d*x+1/2*c)^2*(3*C*cos(2*d*x+2*c)+28*cos(d*x+c)*C-2 *A+2*B+23*C))*tan(1/2*d*x+1/2*c)+12*d*x*(B-2*C))/a^2/d
Time = 0.09 (sec) , antiderivative size = 120, normalized size of antiderivative = 1.17 \[ \int \frac {\cos (c+d x) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right )}{(a+a \cos (c+d x))^2} \, dx=\frac {3 \, {\left (B - 2 \, C\right )} d x \cos \left (d x + c\right )^{2} + 6 \, {\left (B - 2 \, C\right )} d x \cos \left (d x + c\right ) + 3 \, {\left (B - 2 \, C\right )} d x + {\left (3 \, C \cos \left (d x + c\right )^{2} + {\left (2 \, A - 5 \, B + 14 \, C\right )} \cos \left (d x + c\right ) + A - 4 \, B + 10 \, C\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)*(A+B*cos(d*x+c)+C*cos(d*x+c)^2)/(a+a*cos(d*x+c))^2,x, algorithm="fricas")
Output:
1/3*(3*(B - 2*C)*d*x*cos(d*x + c)^2 + 6*(B - 2*C)*d*x*cos(d*x + c) + 3*(B - 2*C)*d*x + (3*C*cos(d*x + c)^2 + (2*A - 5*B + 14*C)*cos(d*x + c) + A - 4 *B + 10*C)*sin(d*x + c))/(a^2*d*cos(d*x + c)^2 + 2*a^2*d*cos(d*x + c) + a^ 2*d)
Leaf count of result is larger than twice the leaf count of optimal. 536 vs. \(2 (97) = 194\).
Time = 1.46 (sec) , antiderivative size = 536, normalized size of antiderivative = 5.20 \[ \int \frac {\cos (c+d x) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right )}{(a+a \cos (c+d x))^2} \, dx=\begin {cases} - \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 {2 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 {3 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 {6 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 {6 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 {8 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 {9 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} - \frac {12 C 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 C d x}{6 a^{2} d \tan ^{2}{\left (\frac {c}{2} + \frac {d x}{2} \right )} + 6 a^{2} d} - \frac {C \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 C \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 C \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 )} + C \cos ^{2}{\left (c \right )}\right ) \cos {\left (c \right )}}{\left (a \cos {\left (c \right )} + a\right )^{2}} & \text {otherwise} \end {cases} \] Input:
integrate(cos(d*x+c)*(A+B*cos(d*x+c)+C*cos(d*x+c)**2)/(a+a*cos(d*x+c))**2, x)
Output:
Piecewise((-A*tan(c/2 + d*x/2)**5/(6*a**2*d*tan(c/2 + d*x/2)**2 + 6*a**2*d ) + 2*A*tan(c/2 + d*x/2)**3/(6*a**2*d*tan(c/2 + d*x/2)**2 + 6*a**2*d) + 3* A*tan(c/2 + d*x/2)/(6*a**2*d*tan(c/2 + d*x/2)**2 + 6*a**2*d) + 6*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) + 6*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) - 8*B*tan(c/2 + d*x/2)**3/(6*a**2*d*tan(c/2 + d*x/2)**2 + 6*a**2*d) - 9*B*tan(c/2 + d*x/2)/(6*a**2*d*tan(c/2 + d*x/2)** 2 + 6*a**2*d) - 12*C*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*C*d*x/(6*a**2*d*tan(c/2 + d*x/2)**2 + 6*a**2*d) - C*tan( c/2 + d*x/2)**5/(6*a**2*d*tan(c/2 + d*x/2)**2 + 6*a**2*d) + 14*C*tan(c/2 + d*x/2)**3/(6*a**2*d*tan(c/2 + d*x/2)**2 + 6*a**2*d) + 27*C*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) + C*cos(c)**2)*cos(c)/(a*cos(c) + a)**2, True))
Leaf count of result is larger than twice the leaf count of optimal. 235 vs. \(2 (99) = 198\).
Time = 0.15 (sec) , antiderivative size = 235, normalized size of antiderivative = 2.28 \[ \int \frac {\cos (c+d x) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right )}{(a+a \cos (c+d x))^2} \, dx=\frac {C {\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 )} - B {\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 )} + \frac {A {\left (\frac {3 \, \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}}\right )}}{a^{2}}}{6 \, d} \] Input:
integrate(cos(d*x+c)*(A+B*cos(d*x+c)+C*cos(d*x+c)^2)/(a+a*cos(d*x+c))^2,x, algorithm="maxima")
Output:
1/6*(C*((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)) ) - B*((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) + A*(3*sin(d* x + c)/(cos(d*x + c) + 1) - sin(d*x + c)^3/(cos(d*x + c) + 1)^3)/a^2)/d
Time = 0.14 (sec) , antiderivative size = 151, normalized size of antiderivative = 1.47 \[ \int \frac {\cos (c+d x) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right )}{(a+a \cos (c+d x))^2} \, dx=\frac {\frac {6 \, {\left (d x + c\right )} {\left (B - 2 \, C\right )}}{a^{2}} + \frac {12 \, C \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} + C a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 3 \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 9 \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 15 \, C a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a^{6}}}{6 \, d} \] Input:
integrate(cos(d*x+c)*(A+B*cos(d*x+c)+C*cos(d*x+c)^2)/(a+a*cos(d*x+c))^2,x, algorithm="giac")
Output:
1/6*(6*(d*x + c)*(B - 2*C)/a^2 + 12*C*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 + C*a^4*tan(1/2*d*x + 1/2*c)^3 - 3*A*a^4*tan(1/2*d*x + 1/2*c) + 9 *B*a^4*tan(1/2*d*x + 1/2*c) - 15*C*a^4*tan(1/2*d*x + 1/2*c))/a^6)/d
Time = 0.32 (sec) , antiderivative size = 107, normalized size of antiderivative = 1.04 \[ \int \frac {\cos (c+d x) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right )}{(a+a \cos (c+d x))^2} \, dx=\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (\frac {A-B+C}{a^2}-\frac {A+B-3\,C}{2\,a^2}\right )}{d}+\frac {x\,\left (B-2\,C\right )}{a^2}+\frac {2\,C\,\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+C\right )}{6\,a^2\,d} \] Input:
int((cos(c + d*x)*(A + B*cos(c + d*x) + C*cos(c + d*x)^2))/(a + a*cos(c + d*x))^2,x)
Output:
(tan(c/2 + (d*x)/2)*((A - B + C)/a^2 - (A + B - 3*C)/(2*a^2)))/d + (x*(B - 2*C))/a^2 + (2*C*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 + C))/(6*a^2*d)
Time = 0.16 (sec) , antiderivative size = 185, normalized size of antiderivative = 1.80 \[ \int \frac {\cos (c+d x) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right )}{(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 -\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5} c +2 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} a -8 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} b +14 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} c +6 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} b d x -12 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} c d x +3 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) a -9 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) b +27 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) c +6 b d x -12 c 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)*(A+B*cos(d*x+c)+C*cos(d*x+c)^2)/(a+a*cos(d*x+c))^2,x)
Output:
( - tan((c + d*x)/2)**5*a + tan((c + d*x)/2)**5*b - tan((c + d*x)/2)**5*c + 2*tan((c + d*x)/2)**3*a - 8*tan((c + d*x)/2)**3*b + 14*tan((c + d*x)/2)* *3*c + 6*tan((c + d*x)/2)**2*b*d*x - 12*tan((c + d*x)/2)**2*c*d*x + 3*tan( (c + d*x)/2)*a - 9*tan((c + d*x)/2)*b + 27*tan((c + d*x)/2)*c + 6*b*d*x - 12*c*d*x)/(6*a**2*d*(tan((c + d*x)/2)**2 + 1))