### 3.4 $$\int \frac{\csc (x)}{a+b \cos (x)+c \cos ^2(x)} \, dx$$

Optimal. Leaf size=129 $-\frac{\left (-2 a c+b^2-2 c^2\right ) \tanh ^{-1}\left (\frac{b+2 c \cos (x)}{\sqrt{b^2-4 a c}}\right )}{(a-b+c) (a+b+c) \sqrt{b^2-4 a c}}+\frac{b \log \left (a+b \cos (x)+c \cos ^2(x)\right )}{2 (a-b+c) (a+b+c)}+\frac{\log (1-\cos (x))}{2 (a+b+c)}-\frac{\log (\cos (x)+1)}{2 (a-b+c)}$

[Out]

-(((b^2 - 2*a*c - 2*c^2)*ArcTanh[(b + 2*c*Cos[x])/Sqrt[b^2 - 4*a*c]])/((a - b + c)*(a + b + c)*Sqrt[b^2 - 4*a*
c])) + Log[1 - Cos[x]]/(2*(a + b + c)) - Log[1 + Cos[x]]/(2*(a - b + c)) + (b*Log[a + b*Cos[x] + c*Cos[x]^2])/
(2*(a - b + c)*(a + b + c))

________________________________________________________________________________________

Rubi [A]  time = 0.171834, antiderivative size = 129, normalized size of antiderivative = 1., number of steps used = 9, number of rules used = 8, integrand size = 17, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.471, Rules used = {3259, 981, 634, 618, 206, 628, 633, 31} $-\frac{\left (-2 a c+b^2-2 c^2\right ) \tanh ^{-1}\left (\frac{b+2 c \cos (x)}{\sqrt{b^2-4 a c}}\right )}{(a-b+c) (a+b+c) \sqrt{b^2-4 a c}}+\frac{b \log \left (a+b \cos (x)+c \cos ^2(x)\right )}{2 (a-b+c) (a+b+c)}+\frac{\log (1-\cos (x))}{2 (a+b+c)}-\frac{\log (\cos (x)+1)}{2 (a-b+c)}$

Antiderivative was successfully veriﬁed.

[In]

Int[Csc[x]/(a + b*Cos[x] + c*Cos[x]^2),x]

[Out]

-(((b^2 - 2*a*c - 2*c^2)*ArcTanh[(b + 2*c*Cos[x])/Sqrt[b^2 - 4*a*c]])/((a - b + c)*(a + b + c)*Sqrt[b^2 - 4*a*
c])) + Log[1 - Cos[x]]/(2*(a + b + c)) - Log[1 + Cos[x]]/(2*(a - b + c)) + (b*Log[a + b*Cos[x] + c*Cos[x]^2])/
(2*(a - b + c)*(a + b + c))

Rule 3259

Int[((a_.) + (b_.)*(cos[(d_.) + (e_.)*(x_)]*(f_.))^(n_.) + (c_.)*(cos[(d_.) + (e_.)*(x_)]*(f_.))^(n2_.))^(p_.)
*sin[(d_.) + (e_.)*(x_)]^(m_.), x_Symbol] :> Module[{g = FreeFactors[Cos[d + e*x], x]}, -Dist[g/e, Subst[Int[(
1 - g^2*x^2)^((m - 1)/2)*(a + b*(f*g*x)^n + c*(f*g*x)^(2*n))^p, x], x, Cos[d + e*x]/g], x]] /; FreeQ[{a, b, c,
d, e, f, n, p}, x] && EqQ[n2, 2*n] && IntegerQ[(m - 1)/2]

Rule 981

Int[1/(((a_) + (b_.)*(x_) + (c_.)*(x_)^2)*((d_) + (f_.)*(x_)^2)), x_Symbol] :> With[{q = c^2*d^2 + b^2*d*f - 2
*a*c*d*f + a^2*f^2}, Dist[1/q, Int[(c^2*d + b^2*f - a*c*f + b*c*f*x)/(a + b*x + c*x^2), x], x] - Dist[1/q, Int
[(c*d*f - a*f^2 + b*f^2*x)/(d + f*x^2), x], x] /; NeQ[q, 0]] /; FreeQ[{a, b, c, d, f}, x] && NeQ[b^2 - 4*a*c,
0]

Rule 634

Int[((d_.) + (e_.)*(x_))/((a_) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Dist[(2*c*d - b*e)/(2*c), Int[1/(a +
b*x + c*x^2), x], x] + Dist[e/(2*c), Int[(b + 2*c*x)/(a + b*x + c*x^2), x], x] /; FreeQ[{a, b, c, d, e}, x] &
& NeQ[2*c*d - b*e, 0] && NeQ[b^2 - 4*a*c, 0] &&  !NiceSqrtQ[b^2 - 4*a*c]

Rule 618

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 206

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTanh[(Rt[-b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[-b, 2]), x]
/; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 628

Int[((d_) + (e_.)*(x_))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Simp[(d*Log[RemoveContent[a + b*x +
c*x^2, x]])/b, x] /; FreeQ[{a, b, c, d, e}, x] && EqQ[2*c*d - b*e, 0]

Rule 633

Int[((d_) + (e_.)*(x_))/((a_) + (c_.)*(x_)^2), x_Symbol] :> With[{q = Rt[-(a*c), 2]}, Dist[e/2 + (c*d)/(2*q),
Int[1/(-q + c*x), x], x] + Dist[e/2 - (c*d)/(2*q), Int[1/(q + c*x), x], x]] /; FreeQ[{a, c, d, e}, x] && NiceS
qrtQ[-(a*c)]

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rubi steps

\begin{align*} \int \frac{\csc (x)}{a+b \cos (x)+c \cos ^2(x)} \, dx &=-\operatorname{Subst}\left (\int \frac{1}{\left (1-x^2\right ) \left (a+b x+c x^2\right )} \, dx,x,\cos (x)\right )\\ &=\frac{\operatorname{Subst}\left (\int \frac{-a-c+b x}{1-x^2} \, dx,x,\cos (x)\right )}{(a-b+c) (a+b+c)}-\frac{\operatorname{Subst}\left (\int \frac{-b^2+a c+c^2-b c x}{a+b x+c x^2} \, dx,x,\cos (x)\right )}{(a-b+c) (a+b+c)}\\ &=\frac{\operatorname{Subst}\left (\int \frac{1}{-1-x} \, dx,x,\cos (x)\right )}{2 (a-b+c)}-\frac{\operatorname{Subst}\left (\int \frac{1}{1-x} \, dx,x,\cos (x)\right )}{2 (a+b+c)}+\frac{b \operatorname{Subst}\left (\int \frac{b+2 c x}{a+b x+c x^2} \, dx,x,\cos (x)\right )}{2 (a-b+c) (a+b+c)}+\frac{\left (b^2-2 c (a+c)\right ) \operatorname{Subst}\left (\int \frac{1}{a+b x+c x^2} \, dx,x,\cos (x)\right )}{2 (a-b+c) (a+b+c)}\\ &=\frac{\log (1-\cos (x))}{2 (a+b+c)}-\frac{\log (1+\cos (x))}{2 (a-b+c)}+\frac{b \log \left (a+b \cos (x)+c \cos ^2(x)\right )}{2 (a-b+c) (a+b+c)}-\frac{\left (b^2-2 c (a+c)\right ) \operatorname{Subst}\left (\int \frac{1}{b^2-4 a c-x^2} \, dx,x,b+2 c \cos (x)\right )}{(a-b+c) (a+b+c)}\\ &=-\frac{\left (b^2-2 c (a+c)\right ) \tanh ^{-1}\left (\frac{b+2 c \cos (x)}{\sqrt{b^2-4 a c}}\right )}{(a-b+c) (a+b+c) \sqrt{b^2-4 a c}}+\frac{\log (1-\cos (x))}{2 (a+b+c)}-\frac{\log (1+\cos (x))}{2 (a-b+c)}+\frac{b \log \left (a+b \cos (x)+c \cos ^2(x)\right )}{2 (a-b+c) (a+b+c)}\\ \end{align*}

Mathematica [A]  time = 0.182346, size = 126, normalized size = 0.98 $-\frac{\sqrt{4 a c-b^2} \left (-b \log \left (a+b \cos (x)+c \cos ^2(x)\right )-(a-b+c) \log (1-\cos (x))+(a+b+c) \log (\cos (x)+1)\right )+\left (4 c (a+c)-2 b^2\right ) \tan ^{-1}\left (\frac{b+2 c \cos (x)}{\sqrt{4 a c-b^2}}\right )}{2 (a-b+c) (a+b+c) \sqrt{4 a c-b^2}}$

Antiderivative was successfully veriﬁed.

[In]

Integrate[Csc[x]/(a + b*Cos[x] + c*Cos[x]^2),x]

[Out]

-((-2*b^2 + 4*c*(a + c))*ArcTan[(b + 2*c*Cos[x])/Sqrt[-b^2 + 4*a*c]] + Sqrt[-b^2 + 4*a*c]*(-((a - b + c)*Log[1
- Cos[x]]) + (a + b + c)*Log[1 + Cos[x]] - b*Log[a + b*Cos[x] + c*Cos[x]^2]))/(2*(a - b + c)*(a + b + c)*Sqrt
[-b^2 + 4*a*c])

________________________________________________________________________________________

Maple [A]  time = 0.036, size = 223, normalized size = 1.7 \begin{align*} -{\frac{\ln \left ( 1+\cos \left ( x \right ) \right ) }{2\,a-2\,b+2\,c}}+{\frac{b\ln \left ( a+b\cos \left ( x \right ) +c \left ( \cos \left ( x \right ) \right ) ^{2} \right ) }{ \left ( 2\,a-2\,b+2\,c \right ) \left ( a+b+c \right ) }}-2\,{\frac{ac}{ \left ( a-b+c \right ) \left ( a+b+c \right ) \sqrt{4\,ac-{b}^{2}}}\arctan \left ({\frac{b+2\,c\cos \left ( x \right ) }{\sqrt{4\,ac-{b}^{2}}}} \right ) }+{\frac{{b}^{2}}{ \left ( a-b+c \right ) \left ( a+b+c \right ) }\arctan \left ({(b+2\,c\cos \left ( x \right ) ){\frac{1}{\sqrt{4\,ac-{b}^{2}}}}} \right ){\frac{1}{\sqrt{4\,ac-{b}^{2}}}}}-2\,{\frac{{c}^{2}}{ \left ( a-b+c \right ) \left ( a+b+c \right ) \sqrt{4\,ac-{b}^{2}}}\arctan \left ({\frac{b+2\,c\cos \left ( x \right ) }{\sqrt{4\,ac-{b}^{2}}}} \right ) }+{\frac{\ln \left ( \cos \left ( x \right ) -1 \right ) }{2\,a+2\,b+2\,c}} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

int(csc(x)/(a+b*cos(x)+c*cos(x)^2),x)

[Out]

-1/(2*a-2*b+2*c)*ln(1+cos(x))+1/2*b*ln(a+b*cos(x)+c*cos(x)^2)/(a-b+c)/(a+b+c)-2/(a-b+c)/(a+b+c)/(4*a*c-b^2)^(1
/2)*arctan((b+2*c*cos(x))/(4*a*c-b^2)^(1/2))*a*c+1/(a-b+c)/(a+b+c)/(4*a*c-b^2)^(1/2)*arctan((b+2*c*cos(x))/(4*
a*c-b^2)^(1/2))*b^2-2/(a-b+c)/(a+b+c)/(4*a*c-b^2)^(1/2)*arctan((b+2*c*cos(x))/(4*a*c-b^2)^(1/2))*c^2+1/(2*a+2*
b+2*c)*ln(cos(x)-1)

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(x)/(a+b*cos(x)+c*cos(x)^2),x, algorithm="maxima")

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [A]  time = 7.3971, size = 1100, normalized size = 8.53 \begin{align*} \left [-\frac{{\left (b^{2} - 2 \, a c - 2 \, c^{2}\right )} \sqrt{b^{2} - 4 \, a c} \log \left (-\frac{2 \, c^{2} \cos \left (x\right )^{2} + 2 \, b c \cos \left (x\right ) + b^{2} - 2 \, a c + \sqrt{b^{2} - 4 \, a c}{\left (2 \, c \cos \left (x\right ) + b\right )}}{c \cos \left (x\right )^{2} + b \cos \left (x\right ) + a}\right ) -{\left (b^{3} - 4 \, a b c\right )} \log \left (c \cos \left (x\right )^{2} + b \cos \left (x\right ) + a\right ) +{\left (a b^{2} + b^{3} - 4 \, a c^{2} -{\left (4 \, a^{2} + 4 \, a b - b^{2}\right )} c\right )} \log \left (\frac{1}{2} \, \cos \left (x\right ) + \frac{1}{2}\right ) -{\left (a b^{2} - b^{3} - 4 \, a c^{2} -{\left (4 \, a^{2} - 4 \, a b - b^{2}\right )} c\right )} \log \left (-\frac{1}{2} \, \cos \left (x\right ) + \frac{1}{2}\right )}{2 \,{\left (a^{2} b^{2} - b^{4} - 4 \, a c^{3} -{\left (8 \, a^{2} - b^{2}\right )} c^{2} - 2 \,{\left (2 \, a^{3} - 3 \, a b^{2}\right )} c\right )}}, -\frac{2 \,{\left (b^{2} - 2 \, a c - 2 \, c^{2}\right )} \sqrt{-b^{2} + 4 \, a c} \arctan \left (-\frac{\sqrt{-b^{2} + 4 \, a c}{\left (2 \, c \cos \left (x\right ) + b\right )}}{b^{2} - 4 \, a c}\right ) -{\left (b^{3} - 4 \, a b c\right )} \log \left (c \cos \left (x\right )^{2} + b \cos \left (x\right ) + a\right ) +{\left (a b^{2} + b^{3} - 4 \, a c^{2} -{\left (4 \, a^{2} + 4 \, a b - b^{2}\right )} c\right )} \log \left (\frac{1}{2} \, \cos \left (x\right ) + \frac{1}{2}\right ) -{\left (a b^{2} - b^{3} - 4 \, a c^{2} -{\left (4 \, a^{2} - 4 \, a b - b^{2}\right )} c\right )} \log \left (-\frac{1}{2} \, \cos \left (x\right ) + \frac{1}{2}\right )}{2 \,{\left (a^{2} b^{2} - b^{4} - 4 \, a c^{3} -{\left (8 \, a^{2} - b^{2}\right )} c^{2} - 2 \,{\left (2 \, a^{3} - 3 \, a b^{2}\right )} c\right )}}\right ] \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(x)/(a+b*cos(x)+c*cos(x)^2),x, algorithm="fricas")

[Out]

[-1/2*((b^2 - 2*a*c - 2*c^2)*sqrt(b^2 - 4*a*c)*log(-(2*c^2*cos(x)^2 + 2*b*c*cos(x) + b^2 - 2*a*c + sqrt(b^2 -
4*a*c)*(2*c*cos(x) + b))/(c*cos(x)^2 + b*cos(x) + a)) - (b^3 - 4*a*b*c)*log(c*cos(x)^2 + b*cos(x) + a) + (a*b^
2 + b^3 - 4*a*c^2 - (4*a^2 + 4*a*b - b^2)*c)*log(1/2*cos(x) + 1/2) - (a*b^2 - b^3 - 4*a*c^2 - (4*a^2 - 4*a*b -
b^2)*c)*log(-1/2*cos(x) + 1/2))/(a^2*b^2 - b^4 - 4*a*c^3 - (8*a^2 - b^2)*c^2 - 2*(2*a^3 - 3*a*b^2)*c), -1/2*(
2*(b^2 - 2*a*c - 2*c^2)*sqrt(-b^2 + 4*a*c)*arctan(-sqrt(-b^2 + 4*a*c)*(2*c*cos(x) + b)/(b^2 - 4*a*c)) - (b^3 -
4*a*b*c)*log(c*cos(x)^2 + b*cos(x) + a) + (a*b^2 + b^3 - 4*a*c^2 - (4*a^2 + 4*a*b - b^2)*c)*log(1/2*cos(x) +
1/2) - (a*b^2 - b^3 - 4*a*c^2 - (4*a^2 - 4*a*b - b^2)*c)*log(-1/2*cos(x) + 1/2))/(a^2*b^2 - b^4 - 4*a*c^3 - (8
*a^2 - b^2)*c^2 - 2*(2*a^3 - 3*a*b^2)*c)]

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{\csc{\left (x \right )}}{a + b \cos{\left (x \right )} + c \cos ^{2}{\left (x \right )}}\, dx \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(x)/(a+b*cos(x)+c*cos(x)**2),x)

[Out]

Integral(csc(x)/(a + b*cos(x) + c*cos(x)**2), x)

________________________________________________________________________________________

Giac [A]  time = 1.16569, size = 176, normalized size = 1.36 \begin{align*} \frac{b \log \left (c \cos \left (x\right )^{2} + b \cos \left (x\right ) + a\right )}{2 \,{\left (a^{2} - b^{2} + 2 \, a c + c^{2}\right )}} + \frac{{\left (b^{2} - 2 \, a c - 2 \, c^{2}\right )} \arctan \left (\frac{2 \, c \cos \left (x\right ) + b}{\sqrt{-b^{2} + 4 \, a c}}\right )}{{\left (a^{2} - b^{2} + 2 \, a c + c^{2}\right )} \sqrt{-b^{2} + 4 \, a c}} - \frac{\log \left (\cos \left (x\right ) + 1\right )}{2 \,{\left (a - b + c\right )}} + \frac{\log \left (-\cos \left (x\right ) + 1\right )}{2 \,{\left (a + b + c\right )}} \end{align*}

Veriﬁcation of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(x)/(a+b*cos(x)+c*cos(x)^2),x, algorithm="giac")

[Out]

1/2*b*log(c*cos(x)^2 + b*cos(x) + a)/(a^2 - b^2 + 2*a*c + c^2) + (b^2 - 2*a*c - 2*c^2)*arctan((2*c*cos(x) + b)
/sqrt(-b^2 + 4*a*c))/((a^2 - b^2 + 2*a*c + c^2)*sqrt(-b^2 + 4*a*c)) - 1/2*log(cos(x) + 1)/(a - b + c) + 1/2*lo
g(-cos(x) + 1)/(a + b + c)