Integrand size = 41, antiderivative size = 156 \[ \int \frac {\cos ^2(c+d x) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right )}{(a+a \sec (c+d x))^2} \, dx=\frac {(7 A-4 B+2 C) x}{2 a^2}-\frac {2 (8 A-5 B+2 C) \sin (c+d x)}{3 a^2 d}+\frac {(7 A-4 B+2 C) \cos (c+d x) \sin (c+d x)}{2 a^2 d}-\frac {(8 A-5 B+2 C) \cos (c+d x) \sin (c+d x)}{3 a^2 d (1+\sec (c+d x))}-\frac {(A-B+C) \cos (c+d x) \sin (c+d x)}{3 d (a+a \sec (c+d x))^2} \] Output:
1/2*(7*A-4*B+2*C)*x/a^2-2/3*(8*A-5*B+2*C)*sin(d*x+c)/a^2/d+1/2*(7*A-4*B+2* C)*cos(d*x+c)*sin(d*x+c)/a^2/d-1/3*(8*A-5*B+2*C)*cos(d*x+c)*sin(d*x+c)/a^2 /d/(1+sec(d*x+c))-1/3*(A-B+C)*cos(d*x+c)*sin(d*x+c)/d/(a+a*sec(d*x+c))^2
Leaf count is larger than twice the leaf count of optimal. \(377\) vs. \(2(156)=312\).
Time = 2.20 (sec) , antiderivative size = 377, normalized size of antiderivative = 2.42 \[ \int \frac {\cos ^2(c+d x) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right )}{(a+a \sec (c+d x))^2} \, dx=\frac {\sec \left (\frac {c}{2}\right ) \sec ^3\left (\frac {1}{2} (c+d x)\right ) \left (36 (7 A-4 B+2 C) d x \cos \left (\frac {d x}{2}\right )+36 (7 A-4 B+2 C) d x \cos \left (c+\frac {d x}{2}\right )+84 A d x \cos \left (c+\frac {3 d x}{2}\right )-48 B d x \cos \left (c+\frac {3 d x}{2}\right )+24 C d x \cos \left (c+\frac {3 d x}{2}\right )+84 A d x \cos \left (2 c+\frac {3 d x}{2}\right )-48 B d x \cos \left (2 c+\frac {3 d x}{2}\right )+24 C d x \cos \left (2 c+\frac {3 d x}{2}\right )-381 A \sin \left (\frac {d x}{2}\right )+264 B \sin \left (\frac {d x}{2}\right )-144 C \sin \left (\frac {d x}{2}\right )+147 A \sin \left (c+\frac {d x}{2}\right )-120 B \sin \left (c+\frac {d x}{2}\right )+96 C \sin \left (c+\frac {d x}{2}\right )-239 A \sin \left (c+\frac {3 d x}{2}\right )+164 B \sin \left (c+\frac {3 d x}{2}\right )-80 C \sin \left (c+\frac {3 d x}{2}\right )-63 A \sin \left (2 c+\frac {3 d x}{2}\right )+36 B \sin \left (2 c+\frac {3 d x}{2}\right )-15 A \sin \left (2 c+\frac {5 d x}{2}\right )+12 B \sin \left (2 c+\frac {5 d x}{2}\right )-15 A \sin \left (3 c+\frac {5 d x}{2}\right )+12 B \sin \left (3 c+\frac {5 d x}{2}\right )+3 A \sin \left (3 c+\frac {7 d x}{2}\right )+3 A \sin \left (4 c+\frac {7 d x}{2}\right )\right )}{192 a^2 d} \] Input:
Integrate[(Cos[c + d*x]^2*(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2))/(a + a* Sec[c + d*x])^2,x]
Output:
(Sec[c/2]*Sec[(c + d*x)/2]^3*(36*(7*A - 4*B + 2*C)*d*x*Cos[(d*x)/2] + 36*( 7*A - 4*B + 2*C)*d*x*Cos[c + (d*x)/2] + 84*A*d*x*Cos[c + (3*d*x)/2] - 48*B *d*x*Cos[c + (3*d*x)/2] + 24*C*d*x*Cos[c + (3*d*x)/2] + 84*A*d*x*Cos[2*c + (3*d*x)/2] - 48*B*d*x*Cos[2*c + (3*d*x)/2] + 24*C*d*x*Cos[2*c + (3*d*x)/2 ] - 381*A*Sin[(d*x)/2] + 264*B*Sin[(d*x)/2] - 144*C*Sin[(d*x)/2] + 147*A*S in[c + (d*x)/2] - 120*B*Sin[c + (d*x)/2] + 96*C*Sin[c + (d*x)/2] - 239*A*S in[c + (3*d*x)/2] + 164*B*Sin[c + (3*d*x)/2] - 80*C*Sin[c + (3*d*x)/2] - 6 3*A*Sin[2*c + (3*d*x)/2] + 36*B*Sin[2*c + (3*d*x)/2] - 15*A*Sin[2*c + (5*d *x)/2] + 12*B*Sin[2*c + (5*d*x)/2] - 15*A*Sin[3*c + (5*d*x)/2] + 12*B*Sin[ 3*c + (5*d*x)/2] + 3*A*Sin[3*c + (7*d*x)/2] + 3*A*Sin[4*c + (7*d*x)/2]))/( 192*a^2*d)
Time = 0.90 (sec) , antiderivative size = 152, normalized size of antiderivative = 0.97, number of steps used = 10, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.244, Rules used = {3042, 4572, 3042, 4508, 3042, 4274, 3042, 3115, 24, 3117}
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) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right )}{(a \sec (c+d x)+a)^2} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {A+B \csc \left (c+d x+\frac {\pi }{2}\right )+C \csc \left (c+d x+\frac {\pi }{2}\right )^2}{\csc \left (c+d x+\frac {\pi }{2}\right )^2 \left (a \csc \left (c+d x+\frac {\pi }{2}\right )+a\right )^2}dx\) |
\(\Big \downarrow \) 4572 |
\(\displaystyle \frac {\int \frac {\cos ^2(c+d x) (a (5 A-2 B+2 C)-3 a (A-B) \sec (c+d x))}{\sec (c+d x) a+a}dx}{3 a^2}-\frac {(A-B+C) \sin (c+d x) \cos (c+d x)}{3 d (a \sec (c+d x)+a)^2}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {\int \frac {a (5 A-2 B+2 C)-3 a (A-B) \csc \left (c+d x+\frac {\pi }{2}\right )}{\csc \left (c+d x+\frac {\pi }{2}\right )^2 \left (\csc \left (c+d x+\frac {\pi }{2}\right ) a+a\right )}dx}{3 a^2}-\frac {(A-B+C) \sin (c+d x) \cos (c+d x)}{3 d (a \sec (c+d x)+a)^2}\) |
\(\Big \downarrow \) 4508 |
\(\displaystyle \frac {\frac {\int \cos ^2(c+d x) \left (3 a^2 (7 A-4 B+2 C)-2 a^2 (8 A-5 B+2 C) \sec (c+d x)\right )dx}{a^2}-\frac {(8 A-5 B+2 C) \sin (c+d x) \cos (c+d x)}{d (\sec (c+d x)+1)}}{3 a^2}-\frac {(A-B+C) \sin (c+d x) \cos (c+d x)}{3 d (a \sec (c+d x)+a)^2}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {\frac {\int \frac {3 a^2 (7 A-4 B+2 C)-2 a^2 (8 A-5 B+2 C) \csc \left (c+d x+\frac {\pi }{2}\right )}{\csc \left (c+d x+\frac {\pi }{2}\right )^2}dx}{a^2}-\frac {(8 A-5 B+2 C) \sin (c+d x) \cos (c+d x)}{d (\sec (c+d x)+1)}}{3 a^2}-\frac {(A-B+C) \sin (c+d x) \cos (c+d x)}{3 d (a \sec (c+d x)+a)^2}\) |
\(\Big \downarrow \) 4274 |
\(\displaystyle \frac {\frac {3 a^2 (7 A-4 B+2 C) \int \cos ^2(c+d x)dx-2 a^2 (8 A-5 B+2 C) \int \cos (c+d x)dx}{a^2}-\frac {(8 A-5 B+2 C) \sin (c+d x) \cos (c+d x)}{d (\sec (c+d x)+1)}}{3 a^2}-\frac {(A-B+C) \sin (c+d x) \cos (c+d x)}{3 d (a \sec (c+d x)+a)^2}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {\frac {3 a^2 (7 A-4 B+2 C) \int \sin \left (c+d x+\frac {\pi }{2}\right )^2dx-2 a^2 (8 A-5 B+2 C) \int \sin \left (c+d x+\frac {\pi }{2}\right )dx}{a^2}-\frac {(8 A-5 B+2 C) \sin (c+d x) \cos (c+d x)}{d (\sec (c+d x)+1)}}{3 a^2}-\frac {(A-B+C) \sin (c+d x) \cos (c+d x)}{3 d (a \sec (c+d x)+a)^2}\) |
\(\Big \downarrow \) 3115 |
\(\displaystyle \frac {\frac {3 a^2 (7 A-4 B+2 C) \left (\frac {\int 1dx}{2}+\frac {\sin (c+d x) \cos (c+d x)}{2 d}\right )-2 a^2 (8 A-5 B+2 C) \int \sin \left (c+d x+\frac {\pi }{2}\right )dx}{a^2}-\frac {(8 A-5 B+2 C) \sin (c+d x) \cos (c+d x)}{d (\sec (c+d x)+1)}}{3 a^2}-\frac {(A-B+C) \sin (c+d x) \cos (c+d x)}{3 d (a \sec (c+d x)+a)^2}\) |
\(\Big \downarrow \) 24 |
\(\displaystyle \frac {\frac {3 a^2 (7 A-4 B+2 C) \left (\frac {\sin (c+d x) \cos (c+d x)}{2 d}+\frac {x}{2}\right )-2 a^2 (8 A-5 B+2 C) \int \sin \left (c+d x+\frac {\pi }{2}\right )dx}{a^2}-\frac {(8 A-5 B+2 C) \sin (c+d x) \cos (c+d x)}{d (\sec (c+d x)+1)}}{3 a^2}-\frac {(A-B+C) \sin (c+d x) \cos (c+d x)}{3 d (a \sec (c+d x)+a)^2}\) |
\(\Big \downarrow \) 3117 |
\(\displaystyle \frac {\frac {3 a^2 (7 A-4 B+2 C) \left (\frac {\sin (c+d x) \cos (c+d x)}{2 d}+\frac {x}{2}\right )-\frac {2 a^2 (8 A-5 B+2 C) \sin (c+d x)}{d}}{a^2}-\frac {(8 A-5 B+2 C) \sin (c+d x) \cos (c+d x)}{d (\sec (c+d x)+1)}}{3 a^2}-\frac {(A-B+C) \sin (c+d x) \cos (c+d x)}{3 d (a \sec (c+d x)+a)^2}\) |
Input:
Int[(Cos[c + d*x]^2*(A + B*Sec[c + d*x] + C*Sec[c + d*x]^2))/(a + a*Sec[c + d*x])^2,x]
Output:
-1/3*((A - B + C)*Cos[c + d*x]*Sin[c + d*x])/(d*(a + a*Sec[c + d*x])^2) + (-(((8*A - 5*B + 2*C)*Cos[c + d*x]*Sin[c + d*x])/(d*(1 + Sec[c + d*x]))) + ((-2*a^2*(8*A - 5*B + 2*C)*Sin[c + d*x])/d + 3*a^2*(7*A - 4*B + 2*C)*(x/2 + (Cos[c + d*x]*Sin[c + d*x])/(2*d)))/a^2)/(3*a^2)
Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d* x]*((b*Sin[c + d*x])^(n - 1)/(d*n)), x] + Simp[b^2*((n - 1)/n) Int[(b*Sin [c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && IntegerQ[ 2*n]
Int[sin[Pi/2 + (c_.) + (d_.)*(x_)], x_Symbol] :> Simp[Sin[c + d*x]/d, x] /; FreeQ[{c, d}, x]
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> Simp[a Int[(d*Csc[e + f*x])^n, x], x] + Simp[b/d In t[(d*Csc[e + f*x])^(n + 1), x], x] /; FreeQ[{a, b, d, e, f, n}, x]
Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + ( a_))^(m_)*(csc[(e_.) + (f_.)*(x_)]*(B_.) + (A_)), x_Symbol] :> Simp[(-(A*b - a*B))*Cot[e + f*x]*(a + b*Csc[e + f*x])^m*((d*Csc[e + f*x])^n/(b*f*(2*m + 1))), x] - Simp[1/(a^2*(2*m + 1)) Int[(a + b*Csc[e + f*x])^(m + 1)*(d*Cs c[e + f*x])^n*Simp[b*B*n - a*A*(2*m + n + 1) + (A*b - a*B)*(m + n + 1)*Csc[ e + f*x], x], x], x] /; FreeQ[{a, b, d, e, f, A, B, n}, x] && NeQ[A*b - a*B , 0] && EqQ[a^2 - b^2, 0] && LtQ[m, -2^(-1)] && !GtQ[n, 0]
Int[((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(C_. ))*(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a _))^(m_), x_Symbol] :> Simp[(-(a*A - b*B + a*C))*Cot[e + f*x]*(a + b*Csc[e + f*x])^m*((d*Csc[e + f*x])^n/(a*f*(2*m + 1))), x] - Simp[1/(a*b*(2*m + 1)) Int[(a + b*Csc[e + f*x])^(m + 1)*(d*Csc[e + f*x])^n*Simp[a*B*n - b*C*n - A*b*(2*m + n + 1) - (b*B*(m + n + 1) - a*(A*(m + n + 1) - C*(m - n)))*Csc[ e + f*x], x], x], x] /; FreeQ[{a, b, d, e, f, A, B, C, n}, x] && EqQ[a^2 - b^2, 0] && LtQ[m, -2^(-1)]
Time = 0.48 (sec) , antiderivative size = 100, normalized size of antiderivative = 0.64
method | result | size |
parallelrisch | \(\frac {\left (\left (12 \left (-A +B \right ) \cos \left (2 d x +2 c \right )+3 A \cos \left (3 d x +3 c \right )+\left (-163 A +112 B \right ) \cos \left (d x +c \right )-140 A +92 B +8 C \right ) \sec \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-80 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+168 x d \left (A -\frac {4 B}{7}+\frac {2 C}{7}\right )}{48 a^{2} d}\) | \(100\) |
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}-7 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) A +5 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) B -3 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) C +\frac {4 \left (-\frac {5 A}{2}+B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}+4 \left (-\frac {3 A}{2}+B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )^{2}}+2 \left (7 A -4 B +2 C \right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d \,a^{2}}\) | \(160\) |
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}-7 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) A +5 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) B -3 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) C +\frac {4 \left (-\frac {5 A}{2}+B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}+4 \left (-\frac {3 A}{2}+B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )^{2}}+2 \left (7 A -4 B +2 C \right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d \,a^{2}}\) | \(160\) |
risch | \(\frac {7 A x}{2 a^{2}}-\frac {2 B x}{a^{2}}+\frac {x C}{a^{2}}-\frac {i A \,{\mathrm e}^{2 i \left (d x +c \right )}}{8 a^{2} d}+\frac {i A \,{\mathrm e}^{i \left (d x +c \right )}}{a^{2} d}-\frac {i B \,{\mathrm e}^{i \left (d x +c \right )}}{2 a^{2} d}-\frac {i A \,{\mathrm e}^{-i \left (d x +c \right )}}{a^{2} d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )} B}{2 a^{2} d}+\frac {i A \,{\mathrm e}^{-2 i \left (d x +c \right )}}{8 a^{2} d}-\frac {2 i \left (12 A \,{\mathrm e}^{2 i \left (d x +c \right )}-9 B \,{\mathrm e}^{2 i \left (d x +c \right )}+6 C \,{\mathrm e}^{2 i \left (d x +c \right )}+21 A \,{\mathrm e}^{i \left (d x +c \right )}-15 B \,{\mathrm e}^{i \left (d x +c \right )}+9 C \,{\mathrm e}^{i \left (d x +c \right )}+11 A -8 B +5 C \right )}{3 d \,a^{2} \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )^{3}}\) | \(240\) |
norman | \(\frac {-\frac {\left (7 A -4 B +2 C \right ) x}{2 a}+\frac {\left (A -B +C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{9}}{6 a d}-\frac {\left (7 A -4 B +2 C \right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}{2 a}+\frac {\left (7 A -4 B +2 C \right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}}{2 a}+\frac {\left (7 A -4 B +2 C \right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6}}{2 a}-\frac {\left (10 A -7 B +4 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{7}}{3 a d}+\frac {\left (13 A -9 B +3 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 a d}+\frac {\left (16 A -7 B +4 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{3 a d}-\frac {\left (26 A -14 B +5 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{3 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 ) a}\) | \(272\) |
Input:
int(cos(d*x+c)^2*(A+B*sec(d*x+c)+C*sec(d*x+c)^2)/(a+a*sec(d*x+c))^2,x,meth od=_RETURNVERBOSE)
Output:
1/48*(((12*(-A+B)*cos(2*d*x+2*c)+3*A*cos(3*d*x+3*c)+(-163*A+112*B)*cos(d*x +c)-140*A+92*B+8*C)*sec(1/2*d*x+1/2*c)^2-80*C)*tan(1/2*d*x+1/2*c)+168*x*d* (A-4/7*B+2/7*C))/a^2/d
Time = 0.08 (sec) , antiderivative size = 153, normalized size of antiderivative = 0.98 \[ \int \frac {\cos ^2(c+d x) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right )}{(a+a \sec (c+d x))^2} \, dx=\frac {3 \, {\left (7 \, A - 4 \, B + 2 \, C\right )} d x \cos \left (d x + c\right )^{2} + 6 \, {\left (7 \, A - 4 \, B + 2 \, C\right )} d x \cos \left (d x + c\right ) + 3 \, {\left (7 \, A - 4 \, B + 2 \, C\right )} d x + {\left (3 \, A \cos \left (d x + c\right )^{3} - 6 \, {\left (A - B\right )} \cos \left (d x + c\right )^{2} - {\left (43 \, A - 28 \, B + 10 \, C\right )} \cos \left (d x + c\right ) - 32 \, A + 20 \, B - 8 \, C\right )} \sin \left (d x + c\right )}{6 \, {\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*sec(d*x+c)+C*sec(d*x+c)^2)/(a+a*sec(d*x+c))^2, x, algorithm="fricas")
Output:
1/6*(3*(7*A - 4*B + 2*C)*d*x*cos(d*x + c)^2 + 6*(7*A - 4*B + 2*C)*d*x*cos( d*x + c) + 3*(7*A - 4*B + 2*C)*d*x + (3*A*cos(d*x + c)^3 - 6*(A - B)*cos(d *x + c)^2 - (43*A - 28*B + 10*C)*cos(d*x + c) - 32*A + 20*B - 8*C)*sin(d*x + c))/(a^2*d*cos(d*x + c)^2 + 2*a^2*d*cos(d*x + c) + a^2*d)
\[ \int \frac {\cos ^2(c+d x) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right )}{(a+a \sec (c+d x))^2} \, dx=\frac {\int \frac {A \cos ^{2}{\left (c + d x \right )}}{\sec ^{2}{\left (c + d x \right )} + 2 \sec {\left (c + d x \right )} + 1}\, dx + \int \frac {B \cos ^{2}{\left (c + d x \right )} \sec {\left (c + d x \right )}}{\sec ^{2}{\left (c + d x \right )} + 2 \sec {\left (c + d x \right )} + 1}\, dx + \int \frac {C \cos ^{2}{\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}}{\sec ^{2}{\left (c + d x \right )} + 2 \sec {\left (c + d x \right )} + 1}\, dx}{a^{2}} \] Input:
integrate(cos(d*x+c)**2*(A+B*sec(d*x+c)+C*sec(d*x+c)**2)/(a+a*sec(d*x+c))* *2,x)
Output:
(Integral(A*cos(c + d*x)**2/(sec(c + d*x)**2 + 2*sec(c + d*x) + 1), x) + I ntegral(B*cos(c + d*x)**2*sec(c + d*x)/(sec(c + d*x)**2 + 2*sec(c + d*x) + 1), x) + Integral(C*cos(c + d*x)**2*sec(c + d*x)**2/(sec(c + d*x)**2 + 2* sec(c + d*x) + 1), x))/a**2
Leaf count of result is larger than twice the leaf count of optimal. 352 vs. \(2 (146) = 292\).
Time = 0.14 (sec) , antiderivative size = 352, normalized size of antiderivative = 2.26 \[ \int \frac {\cos ^2(c+d x) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right )}{(a+a \sec (c+d x))^2} \, dx=-\frac {A {\left (\frac {6 \, {\left (\frac {3 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + \frac {5 \, \sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}}\right )}}{a^{2} + \frac {2 \, a^{2} \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}} + \frac {a^{2} \sin \left (d x + c\right )^{4}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{4}}} + \frac {\frac {21 \, \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 {42 \, \arctan \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{a^{2}}\right )} - 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 )} + 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 {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*sec(d*x+c)+C*sec(d*x+c)^2)/(a+a*sec(d*x+c))^2, x, algorithm="maxima")
Output:
-1/6*(A*(6*(3*sin(d*x + c)/(cos(d*x + c) + 1) + 5*sin(d*x + c)^3/(cos(d*x + c) + 1)^3)/(a^2 + 2*a^2*sin(d*x + c)^2/(cos(d*x + c) + 1)^2 + a^2*sin(d* x + c)^4/(cos(d*x + c) + 1)^4) + (21*sin(d*x + c)/(cos(d*x + c) + 1) - sin (d*x + c)^3/(cos(d*x + c) + 1)^3)/a^2 - 42*arctan(sin(d*x + c)/(cos(d*x + c) + 1))/a^2) - B*((15*sin(d*x + c)/(cos(d*x + c) + 1) - sin(d*x + c)^3/(c os(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))) + C*((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
Time = 0.26 (sec) , antiderivative size = 198, normalized size of antiderivative = 1.27 \[ \int \frac {\cos ^2(c+d x) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right )}{(a+a \sec (c+d x))^2} \, dx=\frac {\frac {3 \, {\left (d x + c\right )} {\left (7 \, A - 4 \, B + 2 \, C\right )}}{a^{2}} - \frac {6 \, {\left (5 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 2 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 3 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, B \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} 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} - 21 \, 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 ) - 9 \, 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)^2*(A+B*sec(d*x+c)+C*sec(d*x+c)^2)/(a+a*sec(d*x+c))^2, x, algorithm="giac")
Output:
1/6*(3*(d*x + c)*(7*A - 4*B + 2*C)/a^2 - 6*(5*A*tan(1/2*d*x + 1/2*c)^3 - 2 *B*tan(1/2*d*x + 1/2*c)^3 + 3*A*tan(1/2*d*x + 1/2*c) - 2*B*tan(1/2*d*x + 1 /2*c))/((tan(1/2*d*x + 1/2*c)^2 + 1)^2*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 - 21*A*a^4 *tan(1/2*d*x + 1/2*c) + 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
Time = 12.73 (sec) , antiderivative size = 159, normalized size of antiderivative = 1.02 \[ \int \frac {\cos ^2(c+d x) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right )}{(a+a \sec (c+d x))^2} \, dx=\frac {x\,\left (7\,A-4\,B+2\,C\right )}{2\,a^2}-\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (\frac {3\,\left (A-B+C\right )}{2\,a^2}+\frac {4\,A-2\,B}{2\,a^2}\right )}{d}-\frac {\left (5\,A-2\,B\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+\left (3\,A-2\,B\right )\,\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 )}^4+2\,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)^2*(A + B/cos(c + d*x) + C/cos(c + d*x)^2))/(a + a/cos(c + d*x))^2,x)
Output:
(x*(7*A - 4*B + 2*C))/(2*a^2) - (tan(c/2 + (d*x)/2)*((3*(A - B + C))/(2*a^ 2) + (4*A - 2*B)/(2*a^2)))/d - (tan(c/2 + (d*x)/2)^3*(5*A - 2*B) + tan(c/2 + (d*x)/2)*(3*A - 2*B))/(d*(2*a^2*tan(c/2 + (d*x)/2)^2 + a^2*tan(c/2 + (d *x)/2)^4 + a^2)) + (tan(c/2 + (d*x)/2)^3*(A - B + C))/(6*a^2*d)
Time = 0.15 (sec) , antiderivative size = 225, normalized size of antiderivative = 1.44 \[ \int \frac {\cos ^2(c+d x) \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right )}{(a+a \sec (c+d x))^2} \, dx=\frac {-9 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{2} a +6 \cos \left (d x +c \right ) \sin \left (d x +c \right )^{2} b +21 \cos \left (d x +c \right ) \sin \left (d x +c \right ) a d x -12 \cos \left (d x +c \right ) \sin \left (d x +c \right ) b d x +6 \cos \left (d x +c \right ) \sin \left (d x +c \right ) c d x -2 \cos \left (d x +c \right ) a +2 \cos \left (d x +c \right ) b -2 \cos \left (d x +c \right ) c -3 \sin \left (d x +c \right )^{4} a -31 \sin \left (d x +c \right )^{2} a +22 \sin \left (d x +c \right )^{2} b -10 \sin \left (d x +c \right )^{2} c +21 \sin \left (d x +c \right ) a d x -12 \sin \left (d x +c \right ) b d x +6 \sin \left (d x +c \right ) c d x +2 a -2 b +2 c}{6 \sin \left (d x +c \right ) a^{2} d \left (\cos \left (d x +c \right )+1\right )} \] Input:
int(cos(d*x+c)^2*(A+B*sec(d*x+c)+C*sec(d*x+c)^2)/(a+a*sec(d*x+c))^2,x)
Output:
( - 9*cos(c + d*x)*sin(c + d*x)**2*a + 6*cos(c + d*x)*sin(c + d*x)**2*b + 21*cos(c + d*x)*sin(c + d*x)*a*d*x - 12*cos(c + d*x)*sin(c + d*x)*b*d*x + 6*cos(c + d*x)*sin(c + d*x)*c*d*x - 2*cos(c + d*x)*a + 2*cos(c + d*x)*b - 2*cos(c + d*x)*c - 3*sin(c + d*x)**4*a - 31*sin(c + d*x)**2*a + 22*sin(c + d*x)**2*b - 10*sin(c + d*x)**2*c + 21*sin(c + d*x)*a*d*x - 12*sin(c + d*x )*b*d*x + 6*sin(c + d*x)*c*d*x + 2*a - 2*b + 2*c)/(6*sin(c + d*x)*a**2*d*( cos(c + d*x) + 1))