Integrand size = 41, antiderivative size = 148 \[ \int \frac {\left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec ^4(c+d x)}{a+a \cos (c+d x)} \, dx=-\frac {(3 A-3 B+2 C) \text {arctanh}(\sin (c+d x))}{2 a d}+\frac {(4 A-3 B+3 C) \tan (c+d x)}{a d}-\frac {(3 A-3 B+2 C) \sec (c+d x) \tan (c+d x)}{2 a d}-\frac {(A-B+C) \sec ^2(c+d x) \tan (c+d x)}{d (a+a \cos (c+d x))}+\frac {(4 A-3 B+3 C) \tan ^3(c+d x)}{3 a d} \] Output:
-1/2*(3*A-3*B+2*C)*arctanh(sin(d*x+c))/a/d+(4*A-3*B+3*C)*tan(d*x+c)/a/d-1/ 2*(3*A-3*B+2*C)*sec(d*x+c)*tan(d*x+c)/a/d-(A-B+C)*sec(d*x+c)^2*tan(d*x+c)/ d/(a+a*cos(d*x+c))+1/3*(4*A-3*B+3*C)*tan(d*x+c)^3/a/d
Leaf count is larger than twice the leaf count of optimal. \(351\) vs. \(2(148)=296\).
Time = 6.57 (sec) , antiderivative size = 351, normalized size of antiderivative = 2.37 \[ \int \frac {\left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec ^4(c+d x)}{a+a \cos (c+d x)} \, dx=\frac {\cos ^2\left (\frac {1}{2} (c+d x)\right ) \left (6 (3 A-3 B+2 C) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )-6 (3 A-3 B+2 C) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )+\frac {-2 A+3 B}{\left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}+\frac {2 A \sin \left (\frac {1}{2} (c+d x)\right )}{\left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )^3}+\frac {4 (5 A-3 B+3 C) \sin \left (\frac {1}{2} (c+d x)\right )}{\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )}+\frac {2 A \sin \left (\frac {1}{2} (c+d x)\right )}{\left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )^3}+\frac {2 A-3 B}{\left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}+\frac {4 (5 A-3 B+3 C) \sin \left (\frac {1}{2} (c+d x)\right )}{\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )}+12 (A-B+C) \tan \left (\frac {1}{2} (c+d x)\right )\right )}{6 a d (1+\cos (c+d x))} \] Input:
Integrate[((A + B*Cos[c + d*x] + C*Cos[c + d*x]^2)*Sec[c + d*x]^4)/(a + a* Cos[c + d*x]),x]
Output:
(Cos[(c + d*x)/2]^2*(6*(3*A - 3*B + 2*C)*Log[Cos[(c + d*x)/2] - Sin[(c + d *x)/2]] - 6*(3*A - 3*B + 2*C)*Log[Cos[(c + d*x)/2] + Sin[(c + d*x)/2]] + ( -2*A + 3*B)/(Cos[(c + d*x)/2] - Sin[(c + d*x)/2])^2 + (2*A*Sin[(c + d*x)/2 ])/(Cos[(c + d*x)/2] - Sin[(c + d*x)/2])^3 + (4*(5*A - 3*B + 3*C)*Sin[(c + d*x)/2])/(Cos[(c + d*x)/2] - Sin[(c + d*x)/2]) + (2*A*Sin[(c + d*x)/2])/( Cos[(c + d*x)/2] + Sin[(c + d*x)/2])^3 + (2*A - 3*B)/(Cos[(c + d*x)/2] + S in[(c + d*x)/2])^2 + (4*(5*A - 3*B + 3*C)*Sin[(c + d*x)/2])/(Cos[(c + d*x) /2] + Sin[(c + d*x)/2]) + 12*(A - B + C)*Tan[(c + d*x)/2]))/(6*a*d*(1 + Co s[c + d*x]))
Time = 0.76 (sec) , antiderivative size = 127, normalized size of antiderivative = 0.86, number of steps used = 11, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.244, Rules used = {3042, 3520, 3042, 3227, 3042, 4254, 2009, 4255, 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 \frac {\sec ^4(c+d x) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right )}{a \cos (c+d x)+a} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {A+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 )^4 \left (a \sin \left (c+d x+\frac {\pi }{2}\right )+a\right )}dx\) |
\(\Big \downarrow \) 3520 |
\(\displaystyle \frac {\int (a (4 A-3 B+3 C)-a (3 A-3 B+2 C) \cos (c+d x)) \sec ^4(c+d x)dx}{a^2}-\frac {(A-B+C) \tan (c+d x) \sec ^2(c+d x)}{d (a \cos (c+d x)+a)}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {\int \frac {a (4 A-3 B+3 C)-a (3 A-3 B+2 C) \sin \left (c+d x+\frac {\pi }{2}\right )}{\sin \left (c+d x+\frac {\pi }{2}\right )^4}dx}{a^2}-\frac {(A-B+C) \tan (c+d x) \sec ^2(c+d x)}{d (a \cos (c+d x)+a)}\) |
\(\Big \downarrow \) 3227 |
\(\displaystyle \frac {a (4 A-3 B+3 C) \int \sec ^4(c+d x)dx-a (3 A-3 B+2 C) \int \sec ^3(c+d x)dx}{a^2}-\frac {(A-B+C) \tan (c+d x) \sec ^2(c+d x)}{d (a \cos (c+d x)+a)}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {a (4 A-3 B+3 C) \int \csc \left (c+d x+\frac {\pi }{2}\right )^4dx-a (3 A-3 B+2 C) \int \csc \left (c+d x+\frac {\pi }{2}\right )^3dx}{a^2}-\frac {(A-B+C) \tan (c+d x) \sec ^2(c+d x)}{d (a \cos (c+d x)+a)}\) |
\(\Big \downarrow \) 4254 |
\(\displaystyle \frac {-\frac {a (4 A-3 B+3 C) \int \left (\tan ^2(c+d x)+1\right )d(-\tan (c+d x))}{d}-a (3 A-3 B+2 C) \int \csc \left (c+d x+\frac {\pi }{2}\right )^3dx}{a^2}-\frac {(A-B+C) \tan (c+d x) \sec ^2(c+d x)}{d (a \cos (c+d x)+a)}\) |
\(\Big \downarrow \) 2009 |
\(\displaystyle \frac {-a (3 A-3 B+2 C) \int \csc \left (c+d x+\frac {\pi }{2}\right )^3dx-\frac {a (4 A-3 B+3 C) \left (-\frac {1}{3} \tan ^3(c+d x)-\tan (c+d x)\right )}{d}}{a^2}-\frac {(A-B+C) \tan (c+d x) \sec ^2(c+d x)}{d (a \cos (c+d x)+a)}\) |
\(\Big \downarrow \) 4255 |
\(\displaystyle \frac {-a (3 A-3 B+2 C) \left (\frac {1}{2} \int \sec (c+d x)dx+\frac {\tan (c+d x) \sec (c+d x)}{2 d}\right )-\frac {a (4 A-3 B+3 C) \left (-\frac {1}{3} \tan ^3(c+d x)-\tan (c+d x)\right )}{d}}{a^2}-\frac {(A-B+C) \tan (c+d x) \sec ^2(c+d x)}{d (a \cos (c+d x)+a)}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {-a (3 A-3 B+2 C) \left (\frac {1}{2} \int \csc \left (c+d x+\frac {\pi }{2}\right )dx+\frac {\tan (c+d x) \sec (c+d x)}{2 d}\right )-\frac {a (4 A-3 B+3 C) \left (-\frac {1}{3} \tan ^3(c+d x)-\tan (c+d x)\right )}{d}}{a^2}-\frac {(A-B+C) \tan (c+d x) \sec ^2(c+d x)}{d (a \cos (c+d x)+a)}\) |
\(\Big \downarrow \) 4257 |
\(\displaystyle \frac {-a (3 A-3 B+2 C) \left (\frac {\text {arctanh}(\sin (c+d x))}{2 d}+\frac {\tan (c+d x) \sec (c+d x)}{2 d}\right )-\frac {a (4 A-3 B+3 C) \left (-\frac {1}{3} \tan ^3(c+d x)-\tan (c+d x)\right )}{d}}{a^2}-\frac {(A-B+C) \tan (c+d x) \sec ^2(c+d x)}{d (a \cos (c+d x)+a)}\) |
Input:
Int[((A + B*Cos[c + d*x] + C*Cos[c + d*x]^2)*Sec[c + d*x]^4)/(a + a*Cos[c + d*x]),x]
Output:
-(((A - B + C)*Sec[c + d*x]^2*Tan[c + d*x])/(d*(a + a*Cos[c + d*x]))) + (- (a*(3*A - 3*B + 2*C)*(ArcTanh[Sin[c + d*x]]/(2*d) + (Sec[c + d*x]*Tan[c + d*x])/(2*d))) - (a*(4*A - 3*B + 3*C)*(-Tan[c + d*x] - Tan[c + d*x]^3/3))/d )/a^2
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]
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)]
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]
Int[(csc[(c_.) + (d_.)*(x_)]*(b_.))^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d* x]*((b*Csc[c + d*x])^(n - 1)/(d*(n - 1))), x] + Simp[b^2*((n - 2)/(n - 1)) Int[(b*Csc[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && IntegerQ[2*n]
Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]
Time = 0.70 (sec) , antiderivative size = 186, normalized size of antiderivative = 1.26
method | result | size |
parallelrisch | \(\frac {9 \left (\cos \left (3 d x +3 c \right )+3 \cos \left (d x +c \right )\right ) \left (A -B +\frac {2 C}{3}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )-9 \left (\cos \left (3 d x +3 c \right )+3 \cos \left (d x +c \right )\right ) \left (A -B +\frac {2 C}{3}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )+16 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (\left (A -\frac {3 B}{4}+\frac {3 C}{4}\right ) \cos \left (3 d x +3 c \right )+\left (\frac {7 A}{8}-\frac {3 B}{8}+\frac {3 C}{4}\right ) \cos \left (2 d x +2 c \right )+\left (\frac {11 A}{4}-\frac {3 B}{2}+\frac {9 C}{4}\right ) \cos \left (d x +c \right )+\frac {11 A}{8}-\frac {3 B}{8}+\frac {3 C}{4}\right )}{6 a d \left (\cos \left (3 d x +3 c \right )+3 \cos \left (d x +c \right )\right )}\) | \(186\) |
derivativedivides | \(\frac {A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) B +C \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-\frac {A}{3 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{3}}-\frac {2 A -B}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{2}}+\left (\frac {3 A}{2}-\frac {3 B}{2}+C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )-\frac {\frac {5 A}{2}-\frac {3 B}{2}+C}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1}-\frac {A}{3 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{3}}-\frac {-2 A +B}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{2}}+\left (-\frac {3 A}{2}+\frac {3 B}{2}-C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-\frac {\frac {5 A}{2}-\frac {3 B}{2}+C}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1}}{d a}\) | \(207\) |
default | \(\frac {A \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) B +C \tan \left (\frac {d x}{2}+\frac {c}{2}\right )-\frac {A}{3 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{3}}-\frac {2 A -B}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{2}}+\left (\frac {3 A}{2}-\frac {3 B}{2}+C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )-\frac {\frac {5 A}{2}-\frac {3 B}{2}+C}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1}-\frac {A}{3 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{3}}-\frac {-2 A +B}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{2}}+\left (-\frac {3 A}{2}+\frac {3 B}{2}-C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-\frac {\frac {5 A}{2}-\frac {3 B}{2}+C}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1}}{d a}\) | \(207\) |
norman | \(\frac {\frac {\left (A -B +C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{11}}{a d}+\frac {\left (A -9 B +3 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{3 a d}-\frac {\left (4 A -2 B +3 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{a d}-\frac {\left (6 A -4 B +3 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{9}}{a d}+\frac {2 \left (7 A -9 B +9 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{3 a d}-\frac {2 \left (10 A -6 B +3 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{7}}{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 )^{3}}+\frac {\left (3 A -3 B +2 C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{2 a d}-\frac {\left (3 A -3 B +2 C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{2 a d}\) | \(259\) |
risch | \(\frac {i \left (9 A \,{\mathrm e}^{6 i \left (d x +c \right )}-9 B \,{\mathrm e}^{6 i \left (d x +c \right )}+6 C \,{\mathrm e}^{6 i \left (d x +c \right )}+9 A \,{\mathrm e}^{5 i \left (d x +c \right )}-9 B \,{\mathrm e}^{5 i \left (d x +c \right )}+6 C \,{\mathrm e}^{5 i \left (d x +c \right )}+24 A \,{\mathrm e}^{4 i \left (d x +c \right )}-24 B \,{\mathrm e}^{4 i \left (d x +c \right )}+24 C \,{\mathrm e}^{4 i \left (d x +c \right )}+24 A \,{\mathrm e}^{3 i \left (d x +c \right )}-12 B \,{\mathrm e}^{3 i \left (d x +c \right )}+12 C \,{\mathrm e}^{3 i \left (d x +c \right )}+39 A \,{\mathrm e}^{2 i \left (d x +c \right )}-27 B \,{\mathrm e}^{2 i \left (d x +c \right )}+30 C \,{\mathrm e}^{2 i \left (d x +c \right )}+7 A \,{\mathrm e}^{i \left (d x +c \right )}-3 B \,{\mathrm e}^{i \left (d x +c \right )}+6 C \,{\mathrm e}^{i \left (d x +c \right )}+16 A -12 B +12 C \right )}{3 a d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3} \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}-\frac {3 A \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{2 a d}+\frac {3 B \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{2 a d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) C}{a d}+\frac {3 A \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{2 a d}-\frac {3 B \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{2 a d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) C}{a d}\) | \(394\) |
Input:
int((A+B*cos(d*x+c)+C*cos(d*x+c)^2)*sec(d*x+c)^4/(a+a*cos(d*x+c)),x,method =_RETURNVERBOSE)
Output:
1/6*(9*(cos(3*d*x+3*c)+3*cos(d*x+c))*(A-B+2/3*C)*ln(tan(1/2*d*x+1/2*c)-1)- 9*(cos(3*d*x+3*c)+3*cos(d*x+c))*(A-B+2/3*C)*ln(tan(1/2*d*x+1/2*c)+1)+16*ta n(1/2*d*x+1/2*c)*((A-3/4*B+3/4*C)*cos(3*d*x+3*c)+(7/8*A-3/8*B+3/4*C)*cos(2 *d*x+2*c)+(11/4*A-3/2*B+9/4*C)*cos(d*x+c)+11/8*A-3/8*B+3/4*C))/a/d/(cos(3* d*x+3*c)+3*cos(d*x+c))
Time = 0.09 (sec) , antiderivative size = 194, normalized size of antiderivative = 1.31 \[ \int \frac {\left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec ^4(c+d x)}{a+a \cos (c+d x)} \, dx=-\frac {3 \, {\left ({\left (3 \, A - 3 \, B + 2 \, C\right )} \cos \left (d x + c\right )^{4} + {\left (3 \, A - 3 \, B + 2 \, C\right )} \cos \left (d x + c\right )^{3}\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \, {\left ({\left (3 \, A - 3 \, B + 2 \, C\right )} \cos \left (d x + c\right )^{4} + {\left (3 \, A - 3 \, B + 2 \, C\right )} \cos \left (d x + c\right )^{3}\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) - 2 \, {\left (4 \, {\left (4 \, A - 3 \, B + 3 \, C\right )} \cos \left (d x + c\right )^{3} + {\left (7 \, A - 3 \, B + 6 \, C\right )} \cos \left (d x + c\right )^{2} - {\left (A - 3 \, B\right )} \cos \left (d x + c\right ) + 2 \, A\right )} \sin \left (d x + c\right )}{12 \, {\left (a d \cos \left (d x + c\right )^{4} + a d \cos \left (d x + c\right )^{3}\right )}} \] Input:
integrate((A+B*cos(d*x+c)+C*cos(d*x+c)^2)*sec(d*x+c)^4/(a+a*cos(d*x+c)),x, algorithm="fricas")
Output:
-1/12*(3*((3*A - 3*B + 2*C)*cos(d*x + c)^4 + (3*A - 3*B + 2*C)*cos(d*x + c )^3)*log(sin(d*x + c) + 1) - 3*((3*A - 3*B + 2*C)*cos(d*x + c)^4 + (3*A - 3*B + 2*C)*cos(d*x + c)^3)*log(-sin(d*x + c) + 1) - 2*(4*(4*A - 3*B + 3*C) *cos(d*x + c)^3 + (7*A - 3*B + 6*C)*cos(d*x + c)^2 - (A - 3*B)*cos(d*x + c ) + 2*A)*sin(d*x + c))/(a*d*cos(d*x + c)^4 + a*d*cos(d*x + c)^3)
\[ \int \frac {\left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec ^4(c+d x)}{a+a \cos (c+d x)} \, dx=\frac {\int \frac {A \sec ^{4}{\left (c + d x \right )}}{\cos {\left (c + d x \right )} + 1}\, dx + \int \frac {B \cos {\left (c + d x \right )} \sec ^{4}{\left (c + d x \right )}}{\cos {\left (c + d x \right )} + 1}\, dx + \int \frac {C \cos ^{2}{\left (c + d x \right )} \sec ^{4}{\left (c + d x \right )}}{\cos {\left (c + d x \right )} + 1}\, dx}{a} \] Input:
integrate((A+B*cos(d*x+c)+C*cos(d*x+c)**2)*sec(d*x+c)**4/(a+a*cos(d*x+c)), x)
Output:
(Integral(A*sec(c + d*x)**4/(cos(c + d*x) + 1), x) + Integral(B*cos(c + d* x)*sec(c + d*x)**4/(cos(c + d*x) + 1), x) + Integral(C*cos(c + d*x)**2*sec (c + d*x)**4/(cos(c + d*x) + 1), x))/a
Leaf count of result is larger than twice the leaf count of optimal. 485 vs. \(2 (142) = 284\).
Time = 0.05 (sec) , antiderivative size = 485, normalized size of antiderivative = 3.28 \[ \int \frac {\left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec ^4(c+d x)}{a+a \cos (c+d x)} \, dx =\text {Too large to display} \] Input:
integrate((A+B*cos(d*x+c)+C*cos(d*x+c)^2)*sec(d*x+c)^4/(a+a*cos(d*x+c)),x, algorithm="maxima")
Output:
1/6*(A*(2*(9*sin(d*x + c)/(cos(d*x + c) + 1) - 16*sin(d*x + c)^3/(cos(d*x + c) + 1)^3 + 15*sin(d*x + c)^5/(cos(d*x + c) + 1)^5)/(a - 3*a*sin(d*x + c )^2/(cos(d*x + c) + 1)^2 + 3*a*sin(d*x + c)^4/(cos(d*x + c) + 1)^4 - a*sin (d*x + c)^6/(cos(d*x + c) + 1)^6) - 9*log(sin(d*x + c)/(cos(d*x + c) + 1) + 1)/a + 9*log(sin(d*x + c)/(cos(d*x + c) + 1) - 1)/a + 6*sin(d*x + c)/(a* (cos(d*x + c) + 1))) - 3*B*(2*(sin(d*x + c)/(cos(d*x + c) + 1) - 3*sin(d*x + c)^3/(cos(d*x + c) + 1)^3)/(a - 2*a*sin(d*x + c)^2/(cos(d*x + c) + 1)^2 + a*sin(d*x + c)^4/(cos(d*x + c) + 1)^4) - 3*log(sin(d*x + c)/(cos(d*x + c) + 1) + 1)/a + 3*log(sin(d*x + c)/(cos(d*x + c) + 1) - 1)/a + 2*sin(d*x + c)/(a*(cos(d*x + c) + 1))) - 6*C*(log(sin(d*x + c)/(cos(d*x + c) + 1) + 1)/a - log(sin(d*x + c)/(cos(d*x + c) + 1) - 1)/a - 2*sin(d*x + c)/((a - a *sin(d*x + c)^2/(cos(d*x + c) + 1)^2)*(cos(d*x + c) + 1)) - sin(d*x + c)/( a*(cos(d*x + c) + 1))))/d
Time = 0.15 (sec) , antiderivative size = 243, normalized size of antiderivative = 1.64 \[ \int \frac {\left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec ^4(c+d x)}{a+a \cos (c+d x)} \, dx=-\frac {\frac {3 \, {\left (3 \, A - 3 \, B + 2 \, C\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right )}{a} - \frac {3 \, {\left (3 \, A - 3 \, B + 2 \, C\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right )}{a} - \frac {6 \, {\left (A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + C \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{a} + \frac {2 \, {\left (15 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 9 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 6 \, C \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 16 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 12 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 12 \, C \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 9 \, A \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 3 \, B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 6 \, C \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 )}^{3} a}}{6 \, d} \] Input:
integrate((A+B*cos(d*x+c)+C*cos(d*x+c)^2)*sec(d*x+c)^4/(a+a*cos(d*x+c)),x, algorithm="giac")
Output:
-1/6*(3*(3*A - 3*B + 2*C)*log(abs(tan(1/2*d*x + 1/2*c) + 1))/a - 3*(3*A - 3*B + 2*C)*log(abs(tan(1/2*d*x + 1/2*c) - 1))/a - 6*(A*tan(1/2*d*x + 1/2*c ) - B*tan(1/2*d*x + 1/2*c) + C*tan(1/2*d*x + 1/2*c))/a + 2*(15*A*tan(1/2*d *x + 1/2*c)^5 - 9*B*tan(1/2*d*x + 1/2*c)^5 + 6*C*tan(1/2*d*x + 1/2*c)^5 - 16*A*tan(1/2*d*x + 1/2*c)^3 + 12*B*tan(1/2*d*x + 1/2*c)^3 - 12*C*tan(1/2*d *x + 1/2*c)^3 + 9*A*tan(1/2*d*x + 1/2*c) - 3*B*tan(1/2*d*x + 1/2*c) + 6*C* tan(1/2*d*x + 1/2*c))/((tan(1/2*d*x + 1/2*c)^2 - 1)^3*a))/d
Time = 0.64 (sec) , antiderivative size = 187, normalized size of antiderivative = 1.26 \[ \int \frac {\left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec ^4(c+d x)}{a+a \cos (c+d x)} \, dx=\frac {\left (5\,A-3\,B+2\,C\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+\left (4\,B-\frac {16\,A}{3}-4\,C\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+\left (3\,A-B+2\,C\right )\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left (-a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6+3\,a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4-3\,a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+a\right )}+\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (A-B+C\right )}{a\,d}-\frac {2\,\mathrm {atanh}\left (\frac {2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (\frac {3\,A}{2}-\frac {3\,B}{2}+C\right )}{3\,A-3\,B+2\,C}\right )\,\left (\frac {3\,A}{2}-\frac {3\,B}{2}+C\right )}{a\,d} \] Input:
int((A + B*cos(c + d*x) + C*cos(c + d*x)^2)/(cos(c + d*x)^4*(a + a*cos(c + d*x))),x)
Output:
(tan(c/2 + (d*x)/2)*(3*A - B + 2*C) + tan(c/2 + (d*x)/2)^5*(5*A - 3*B + 2* C) - tan(c/2 + (d*x)/2)^3*((16*A)/3 - 4*B + 4*C))/(d*(a - 3*a*tan(c/2 + (d *x)/2)^2 + 3*a*tan(c/2 + (d*x)/2)^4 - a*tan(c/2 + (d*x)/2)^6)) + (tan(c/2 + (d*x)/2)*(A - B + C))/(a*d) - (2*atanh((2*tan(c/2 + (d*x)/2)*((3*A)/2 - (3*B)/2 + C))/(3*A - 3*B + 2*C))*((3*A)/2 - (3*B)/2 + C))/(a*d)
Time = 0.16 (sec) , antiderivative size = 526, normalized size of antiderivative = 3.55 \[ \int \frac {\left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec ^4(c+d x)}{a+a \cos (c+d x)} \, dx =\text {Too large to display} \] Input:
int((A+B*cos(d*x+c)+C*cos(d*x+c)^2)*sec(d*x+c)^4/(a+a*cos(d*x+c)),x)
Output:
(9*cos(c + d*x)*log(tan((c + d*x)/2) - 1)*sin(c + d*x)**3*a - 9*cos(c + d* x)*log(tan((c + d*x)/2) - 1)*sin(c + d*x)**3*b + 6*cos(c + d*x)*log(tan((c + d*x)/2) - 1)*sin(c + d*x)**3*c - 9*cos(c + d*x)*log(tan((c + d*x)/2) - 1)*sin(c + d*x)*a + 9*cos(c + d*x)*log(tan((c + d*x)/2) - 1)*sin(c + d*x)* b - 6*cos(c + d*x)*log(tan((c + d*x)/2) - 1)*sin(c + d*x)*c - 9*cos(c + d* x)*log(tan((c + d*x)/2) + 1)*sin(c + d*x)**3*a + 9*cos(c + d*x)*log(tan((c + d*x)/2) + 1)*sin(c + d*x)**3*b - 6*cos(c + d*x)*log(tan((c + d*x)/2) + 1)*sin(c + d*x)**3*c + 9*cos(c + d*x)*log(tan((c + d*x)/2) + 1)*sin(c + d* x)*a - 9*cos(c + d*x)*log(tan((c + d*x)/2) + 1)*sin(c + d*x)*b + 6*cos(c + d*x)*log(tan((c + d*x)/2) + 1)*sin(c + d*x)*c + 9*cos(c + d*x)*sin(c + d* x)**2*a - 9*cos(c + d*x)*sin(c + d*x)**2*b + 6*cos(c + d*x)*sin(c + d*x)** 2*c - 6*cos(c + d*x)*a + 6*cos(c + d*x)*b - 6*cos(c + d*x)*c + 16*sin(c + d*x)**4*a - 12*sin(c + d*x)**4*b + 12*sin(c + d*x)**4*c - 24*sin(c + d*x)* *2*a + 18*sin(c + d*x)**2*b - 18*sin(c + d*x)**2*c + 6*a - 6*b + 6*c)/(6*c os(c + d*x)*sin(c + d*x)*a*d*(sin(c + d*x)**2 - 1))