3.186 \(\int \frac {x^2}{a+b \cos (c+d x)} \, dx\)

Optimal. Leaf size=329 \[ -\frac {2 i \text {Li}_3\left (-\frac {b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{d^3 \sqrt {a^2-b^2}}+\frac {2 i \text {Li}_3\left (-\frac {b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{d^3 \sqrt {a^2-b^2}}-\frac {2 x \text {Li}_2\left (-\frac {b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{d^2 \sqrt {a^2-b^2}}+\frac {2 x \text {Li}_2\left (-\frac {b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{d^2 \sqrt {a^2-b^2}}-\frac {i x^2 \log \left (1+\frac {b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{d \sqrt {a^2-b^2}}+\frac {i x^2 \log \left (1+\frac {b e^{i (c+d x)}}{\sqrt {a^2-b^2}+a}\right )}{d \sqrt {a^2-b^2}} \]

[Out]

-I*x^2*ln(1+b*exp(I*(d*x+c))/(a-(a^2-b^2)^(1/2)))/d/(a^2-b^2)^(1/2)+I*x^2*ln(1+b*exp(I*(d*x+c))/(a+(a^2-b^2)^(
1/2)))/d/(a^2-b^2)^(1/2)-2*x*polylog(2,-b*exp(I*(d*x+c))/(a-(a^2-b^2)^(1/2)))/d^2/(a^2-b^2)^(1/2)+2*x*polylog(
2,-b*exp(I*(d*x+c))/(a+(a^2-b^2)^(1/2)))/d^2/(a^2-b^2)^(1/2)-2*I*polylog(3,-b*exp(I*(d*x+c))/(a-(a^2-b^2)^(1/2
)))/d^3/(a^2-b^2)^(1/2)+2*I*polylog(3,-b*exp(I*(d*x+c))/(a+(a^2-b^2)^(1/2)))/d^3/(a^2-b^2)^(1/2)

________________________________________________________________________________________

Rubi [A]  time = 0.66, antiderivative size = 329, normalized size of antiderivative = 1.00, number of steps used = 10, number of rules used = 6, integrand size = 16, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.375, Rules used = {3321, 2264, 2190, 2531, 2282, 6589} \[ -\frac {2 x \text {Li}_2\left (-\frac {b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{d^2 \sqrt {a^2-b^2}}+\frac {2 x \text {Li}_2\left (-\frac {b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{d^2 \sqrt {a^2-b^2}}-\frac {2 i \text {Li}_3\left (-\frac {b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{d^3 \sqrt {a^2-b^2}}+\frac {2 i \text {Li}_3\left (-\frac {b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{d^3 \sqrt {a^2-b^2}}-\frac {i x^2 \log \left (1+\frac {b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{d \sqrt {a^2-b^2}}+\frac {i x^2 \log \left (1+\frac {b e^{i (c+d x)}}{\sqrt {a^2-b^2}+a}\right )}{d \sqrt {a^2-b^2}} \]

Antiderivative was successfully verified.

[In]

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

[Out]

((-I)*x^2*Log[1 + (b*E^(I*(c + d*x)))/(a - Sqrt[a^2 - b^2])])/(Sqrt[a^2 - b^2]*d) + (I*x^2*Log[1 + (b*E^(I*(c
+ d*x)))/(a + Sqrt[a^2 - b^2])])/(Sqrt[a^2 - b^2]*d) - (2*x*PolyLog[2, -((b*E^(I*(c + d*x)))/(a - Sqrt[a^2 - b
^2]))])/(Sqrt[a^2 - b^2]*d^2) + (2*x*PolyLog[2, -((b*E^(I*(c + d*x)))/(a + Sqrt[a^2 - b^2]))])/(Sqrt[a^2 - b^2
]*d^2) - ((2*I)*PolyLog[3, -((b*E^(I*(c + d*x)))/(a - Sqrt[a^2 - b^2]))])/(Sqrt[a^2 - b^2]*d^3) + ((2*I)*PolyL
og[3, -((b*E^(I*(c + d*x)))/(a + Sqrt[a^2 - b^2]))])/(Sqrt[a^2 - b^2]*d^3)

Rule 2190

Int[(((F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)*((c_.) + (d_.)*(x_))^(m_.))/((a_) + (b_.)*((F_)^((g_.)*((e_.) +
 (f_.)*(x_))))^(n_.)), x_Symbol] :> Simp[((c + d*x)^m*Log[1 + (b*(F^(g*(e + f*x)))^n)/a])/(b*f*g*n*Log[F]), x]
 - Dist[(d*m)/(b*f*g*n*Log[F]), Int[(c + d*x)^(m - 1)*Log[1 + (b*(F^(g*(e + f*x)))^n)/a], x], x] /; FreeQ[{F,
a, b, c, d, e, f, g, n}, x] && IGtQ[m, 0]

Rule 2264

Int[((F_)^(u_)*((f_.) + (g_.)*(x_))^(m_.))/((a_.) + (b_.)*(F_)^(u_) + (c_.)*(F_)^(v_)), x_Symbol] :> With[{q =
 Rt[b^2 - 4*a*c, 2]}, Dist[(2*c)/q, Int[((f + g*x)^m*F^u)/(b - q + 2*c*F^u), x], x] - Dist[(2*c)/q, Int[((f +
g*x)^m*F^u)/(b + q + 2*c*F^u), x], x]] /; FreeQ[{F, a, b, c, f, g}, x] && EqQ[v, 2*u] && LinearQ[u, x] && NeQ[
b^2 - 4*a*c, 0] && IGtQ[m, 0]

Rule 2282

Int[u_, x_Symbol] :> With[{v = FunctionOfExponential[u, x]}, Dist[v/D[v, x], Subst[Int[FunctionOfExponentialFu
nction[u, x]/x, x], x, v], x]] /; FunctionOfExponentialQ[u, x] &&  !MatchQ[u, (w_)*((a_.)*(v_)^(n_))^(m_) /; F
reeQ[{a, m, n}, x] && IntegerQ[m*n]] &&  !MatchQ[u, E^((c_.)*((a_.) + (b_.)*x))*(F_)[v_] /; FreeQ[{a, b, c}, x
] && InverseFunctionQ[F[x]]]

Rule 2531

Int[Log[1 + (e_.)*((F_)^((c_.)*((a_.) + (b_.)*(x_))))^(n_.)]*((f_.) + (g_.)*(x_))^(m_.), x_Symbol] :> -Simp[((
f + g*x)^m*PolyLog[2, -(e*(F^(c*(a + b*x)))^n)])/(b*c*n*Log[F]), x] + Dist[(g*m)/(b*c*n*Log[F]), Int[(f + g*x)
^(m - 1)*PolyLog[2, -(e*(F^(c*(a + b*x)))^n)], x], x] /; FreeQ[{F, a, b, c, e, f, g, n}, x] && GtQ[m, 0]

Rule 3321

Int[((c_.) + (d_.)*(x_))^(m_.)/((a_) + (b_.)*sin[(e_.) + Pi*(k_.) + (f_.)*(x_)]), x_Symbol] :> Dist[2, Int[((c
 + d*x)^m*E^(I*Pi*(k - 1/2))*E^(I*(e + f*x)))/(b + 2*a*E^(I*Pi*(k - 1/2))*E^(I*(e + f*x)) - b*E^(2*I*k*Pi)*E^(
2*I*(e + f*x))), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && IntegerQ[2*k] && NeQ[a^2 - b^2, 0] && IGtQ[m, 0]

Rule 6589

Int[PolyLog[n_, (c_.)*((a_.) + (b_.)*(x_))^(p_.)]/((d_.) + (e_.)*(x_)), x_Symbol] :> Simp[PolyLog[n + 1, c*(a
+ b*x)^p]/(e*p), x] /; FreeQ[{a, b, c, d, e, n, p}, x] && EqQ[b*d, a*e]

Rubi steps

\begin {align*} \int \frac {x^2}{a+b \cos (c+d x)} \, dx &=2 \int \frac {e^{i (c+d x)} x^2}{b+2 a e^{i (c+d x)}+b e^{2 i (c+d x)}} \, dx\\ &=\frac {(2 b) \int \frac {e^{i (c+d x)} x^2}{2 a-2 \sqrt {a^2-b^2}+2 b e^{i (c+d x)}} \, dx}{\sqrt {a^2-b^2}}-\frac {(2 b) \int \frac {e^{i (c+d x)} x^2}{2 a+2 \sqrt {a^2-b^2}+2 b e^{i (c+d x)}} \, dx}{\sqrt {a^2-b^2}}\\ &=-\frac {i x^2 \log \left (1+\frac {b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2} d}+\frac {i x^2 \log \left (1+\frac {b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2} d}+\frac {(2 i) \int x \log \left (1+\frac {2 b e^{i (c+d x)}}{2 a-2 \sqrt {a^2-b^2}}\right ) \, dx}{\sqrt {a^2-b^2} d}-\frac {(2 i) \int x \log \left (1+\frac {2 b e^{i (c+d x)}}{2 a+2 \sqrt {a^2-b^2}}\right ) \, dx}{\sqrt {a^2-b^2} d}\\ &=-\frac {i x^2 \log \left (1+\frac {b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2} d}+\frac {i x^2 \log \left (1+\frac {b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2} d}-\frac {2 x \text {Li}_2\left (-\frac {b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2} d^2}+\frac {2 x \text {Li}_2\left (-\frac {b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2} d^2}+\frac {2 \int \text {Li}_2\left (-\frac {2 b e^{i (c+d x)}}{2 a-2 \sqrt {a^2-b^2}}\right ) \, dx}{\sqrt {a^2-b^2} d^2}-\frac {2 \int \text {Li}_2\left (-\frac {2 b e^{i (c+d x)}}{2 a+2 \sqrt {a^2-b^2}}\right ) \, dx}{\sqrt {a^2-b^2} d^2}\\ &=-\frac {i x^2 \log \left (1+\frac {b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2} d}+\frac {i x^2 \log \left (1+\frac {b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2} d}-\frac {2 x \text {Li}_2\left (-\frac {b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2} d^2}+\frac {2 x \text {Li}_2\left (-\frac {b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2} d^2}-\frac {(2 i) \operatorname {Subst}\left (\int \frac {\text {Li}_2\left (\frac {b x}{-a+\sqrt {a^2-b^2}}\right )}{x} \, dx,x,e^{i (c+d x)}\right )}{\sqrt {a^2-b^2} d^3}+\frac {(2 i) \operatorname {Subst}\left (\int \frac {\text {Li}_2\left (-\frac {b x}{a+\sqrt {a^2-b^2}}\right )}{x} \, dx,x,e^{i (c+d x)}\right )}{\sqrt {a^2-b^2} d^3}\\ &=-\frac {i x^2 \log \left (1+\frac {b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2} d}+\frac {i x^2 \log \left (1+\frac {b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2} d}-\frac {2 x \text {Li}_2\left (-\frac {b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2} d^2}+\frac {2 x \text {Li}_2\left (-\frac {b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2} d^2}-\frac {2 i \text {Li}_3\left (-\frac {b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2} d^3}+\frac {2 i \text {Li}_3\left (-\frac {b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2} d^3}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.72, size = 379, normalized size = 1.15 \[ \frac {e^{i c} \left (-i \left (d^2 x^2 \log \left (1+\frac {b e^{i (2 c+d x)}}{a e^{i c}-\sqrt {e^{2 i c} \left (a^2-b^2\right )}}\right )-d^2 x^2 \log \left (1+\frac {b e^{i (2 c+d x)}}{\sqrt {e^{2 i c} \left (a^2-b^2\right )}+a e^{i c}}\right )+2 i d x \text {Li}_2\left (-\frac {b e^{i (2 c+d x)}}{e^{i c} a+\sqrt {\left (a^2-b^2\right ) e^{2 i c}}}\right )+2 \text {Li}_3\left (-\frac {b e^{i (2 c+d x)}}{a e^{i c}-\sqrt {\left (a^2-b^2\right ) e^{2 i c}}}\right )-2 \text {Li}_3\left (-\frac {b e^{i (2 c+d x)}}{e^{i c} a+\sqrt {\left (a^2-b^2\right ) e^{2 i c}}}\right )\right )-2 d x \text {Li}_2\left (-\frac {b e^{i (2 c+d x)}}{a e^{i c}-\sqrt {\left (a^2-b^2\right ) e^{2 i c}}}\right )\right )}{d^3 \sqrt {e^{2 i c} \left (a^2-b^2\right )}} \]

Antiderivative was successfully verified.

[In]

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

[Out]

(E^(I*c)*(-2*d*x*PolyLog[2, -((b*E^(I*(2*c + d*x)))/(a*E^(I*c) - Sqrt[(a^2 - b^2)*E^((2*I)*c)]))] - I*(d^2*x^2
*Log[1 + (b*E^(I*(2*c + d*x)))/(a*E^(I*c) - Sqrt[(a^2 - b^2)*E^((2*I)*c)])] - d^2*x^2*Log[1 + (b*E^(I*(2*c + d
*x)))/(a*E^(I*c) + Sqrt[(a^2 - b^2)*E^((2*I)*c)])] + (2*I)*d*x*PolyLog[2, -((b*E^(I*(2*c + d*x)))/(a*E^(I*c) +
 Sqrt[(a^2 - b^2)*E^((2*I)*c)]))] + 2*PolyLog[3, -((b*E^(I*(2*c + d*x)))/(a*E^(I*c) - Sqrt[(a^2 - b^2)*E^((2*I
)*c)]))] - 2*PolyLog[3, -((b*E^(I*(2*c + d*x)))/(a*E^(I*c) + Sqrt[(a^2 - b^2)*E^((2*I)*c)]))])))/(d^3*Sqrt[(a^
2 - b^2)*E^((2*I)*c)])

________________________________________________________________________________________

fricas [C]  time = 0.79, size = 1267, normalized size = 3.85 \[ \text {result too large to display} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-1/4*(4*b*d*x*sqrt((a^2 - b^2)/b^2)*dilog(-(a*cos(d*x + c) + I*a*sin(d*x + c) + (b*cos(d*x + c) + I*b*sin(d*x
+ c))*sqrt((a^2 - b^2)/b^2) + b)/b + 1) - 4*b*d*x*sqrt((a^2 - b^2)/b^2)*dilog(-(a*cos(d*x + c) + I*a*sin(d*x +
 c) - (b*cos(d*x + c) + I*b*sin(d*x + c))*sqrt((a^2 - b^2)/b^2) + b)/b + 1) + 4*b*d*x*sqrt((a^2 - b^2)/b^2)*di
log(-(a*cos(d*x + c) - I*a*sin(d*x + c) + (b*cos(d*x + c) - I*b*sin(d*x + c))*sqrt((a^2 - b^2)/b^2) + b)/b + 1
) - 4*b*d*x*sqrt((a^2 - b^2)/b^2)*dilog(-(a*cos(d*x + c) - I*a*sin(d*x + c) - (b*cos(d*x + c) - I*b*sin(d*x +
c))*sqrt((a^2 - b^2)/b^2) + b)/b + 1) - 2*I*b*c^2*sqrt((a^2 - b^2)/b^2)*log(2*b*cos(d*x + c) + 2*I*b*sin(d*x +
 c) + 2*b*sqrt((a^2 - b^2)/b^2) + 2*a) + 2*I*b*c^2*sqrt((a^2 - b^2)/b^2)*log(2*b*cos(d*x + c) - 2*I*b*sin(d*x
+ c) + 2*b*sqrt((a^2 - b^2)/b^2) + 2*a) - 2*I*b*c^2*sqrt((a^2 - b^2)/b^2)*log(-2*b*cos(d*x + c) + 2*I*b*sin(d*
x + c) + 2*b*sqrt((a^2 - b^2)/b^2) - 2*a) + 2*I*b*c^2*sqrt((a^2 - b^2)/b^2)*log(-2*b*cos(d*x + c) - 2*I*b*sin(
d*x + c) + 2*b*sqrt((a^2 - b^2)/b^2) - 2*a) + 2*(I*b*d^2*x^2 - I*b*c^2)*sqrt((a^2 - b^2)/b^2)*log((a*cos(d*x +
 c) + I*a*sin(d*x + c) + (b*cos(d*x + c) + I*b*sin(d*x + c))*sqrt((a^2 - b^2)/b^2) + b)/b) + 2*(-I*b*d^2*x^2 +
 I*b*c^2)*sqrt((a^2 - b^2)/b^2)*log((a*cos(d*x + c) + I*a*sin(d*x + c) - (b*cos(d*x + c) + I*b*sin(d*x + c))*s
qrt((a^2 - b^2)/b^2) + b)/b) + 2*(-I*b*d^2*x^2 + I*b*c^2)*sqrt((a^2 - b^2)/b^2)*log((a*cos(d*x + c) - I*a*sin(
d*x + c) + (b*cos(d*x + c) - I*b*sin(d*x + c))*sqrt((a^2 - b^2)/b^2) + b)/b) + 2*(I*b*d^2*x^2 - I*b*c^2)*sqrt(
(a^2 - b^2)/b^2)*log((a*cos(d*x + c) - I*a*sin(d*x + c) - (b*cos(d*x + c) - I*b*sin(d*x + c))*sqrt((a^2 - b^2)
/b^2) + b)/b) + 4*I*b*sqrt((a^2 - b^2)/b^2)*polylog(3, -(a*cos(d*x + c) + I*a*sin(d*x + c) + (b*cos(d*x + c) +
 I*b*sin(d*x + c))*sqrt((a^2 - b^2)/b^2))/b) - 4*I*b*sqrt((a^2 - b^2)/b^2)*polylog(3, -(a*cos(d*x + c) + I*a*s
in(d*x + c) - (b*cos(d*x + c) + I*b*sin(d*x + c))*sqrt((a^2 - b^2)/b^2))/b) - 4*I*b*sqrt((a^2 - b^2)/b^2)*poly
log(3, -(a*cos(d*x + c) - I*a*sin(d*x + c) + (b*cos(d*x + c) - I*b*sin(d*x + c))*sqrt((a^2 - b^2)/b^2))/b) + 4
*I*b*sqrt((a^2 - b^2)/b^2)*polylog(3, -(a*cos(d*x + c) - I*a*sin(d*x + c) - (b*cos(d*x + c) - I*b*sin(d*x + c)
)*sqrt((a^2 - b^2)/b^2))/b))/((a^2 - b^2)*d^3)

________________________________________________________________________________________

giac [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \frac {x^{2}}{b \cos \left (d x + c\right ) + a}\,{d x} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maple [F]  time = 0.16, size = 0, normalized size = 0.00 \[ \int \frac {x^{2}}{a +b \cos \left (d x +c \right )}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maxima [F(-2)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: ValueError} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(4*b^2-4*a^2>0)', see `assume?`
 for more details)Is 4*b^2-4*a^2 positive or negative?

________________________________________________________________________________________

mupad [F]  time = 0.00, size = -1, normalized size = -0.00 \[ \int \frac {x^2}{a+b\,\cos \left (c+d\,x\right )} \,d x \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

sympy [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \frac {x^{2}}{a + b \cos {\left (c + d x \right )}}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________