\(\int \frac {x (b+a \cos (x))}{(a+b \cos (x))^2} \, dx\) [200]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [B] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F(-1)]
   Maxima [F(-2)]
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 16, antiderivative size = 24 \[ \int \frac {x (b+a \cos (x))}{(a+b \cos (x))^2} \, dx=\frac {\log (a+b \cos (x))}{b}+\frac {x \sin (x)}{a+b \cos (x)} \]

[Out]

ln(a+b*cos(x))/b+x*sin(x)/(a+b*cos(x))

Rubi [A] (verified)

Time = 0.06 (sec) , antiderivative size = 24, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.188, Rules used = {4689, 2747, 31} \[ \int \frac {x (b+a \cos (x))}{(a+b \cos (x))^2} \, dx=\frac {\log (a+b \cos (x))}{b}+\frac {x \sin (x)}{a+b \cos (x)} \]

[In]

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

[Out]

Log[a + b*Cos[x]]/b + (x*Sin[x])/(a + b*Cos[x])

Rule 31

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

Rule 2747

Int[cos[(e_.) + (f_.)*(x_)]^(p_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.), x_Symbol] :> Dist[1/(b^p*f), S
ubst[Int[(a + x)^m*(b^2 - x^2)^((p - 1)/2), x], x, b*Sin[e + f*x]], x] /; FreeQ[{a, b, e, f, m}, x] && Integer
Q[(p - 1)/2] && NeQ[a^2 - b^2, 0]

Rule 4689

Int[((Cos[(c_.) + (d_.)*(x_)]*(B_.) + (A_))*((e_.) + (f_.)*(x_)))/(Cos[(c_.) + (d_.)*(x_)]*(b_.) + (a_))^2, x_
Symbol] :> Simp[B*(e + f*x)*(Sin[c + d*x]/(a*d*(a + b*Cos[c + d*x]))), x] - Dist[B*(f/(a*d)), Int[Sin[c + d*x]
/(a + b*Cos[c + d*x]), x], x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && EqQ[a*A - b*B, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {x \sin (x)}{a+b \cos (x)}-\int \frac {\sin (x)}{a+b \cos (x)} \, dx \\ & = \frac {x \sin (x)}{a+b \cos (x)}+\frac {\text {Subst}\left (\int \frac {1}{a+x} \, dx,x,b \cos (x)\right )}{b} \\ & = \frac {\log (a+b \cos (x))}{b}+\frac {x \sin (x)}{a+b \cos (x)} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.12 (sec) , antiderivative size = 24, normalized size of antiderivative = 1.00 \[ \int \frac {x (b+a \cos (x))}{(a+b \cos (x))^2} \, dx=\frac {\log (a+b \cos (x))}{b}+\frac {x \sin (x)}{a+b \cos (x)} \]

[In]

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

[Out]

Log[a + b*Cos[x]]/b + (x*Sin[x])/(a + b*Cos[x])

Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(56\) vs. \(2(24)=48\).

Time = 0.62 (sec) , antiderivative size = 57, normalized size of antiderivative = 2.38

method result size
parallelrisch \(\frac {\left (a +b \cos \left (x \right )\right ) \ln \left (\frac {a +b \cos \left (x \right )}{\cos \left (x \right )+1}\right )+\left (-a -b \cos \left (x \right )\right ) \ln \left (\frac {1}{\cos \left (x \right )+1}\right )+b x \sin \left (x \right )}{b \left (a +b \cos \left (x \right )\right )}\) \(57\)
risch \(-\frac {2 i x}{b}+\frac {2 i x \left (a \,{\mathrm e}^{i x}+b \right )}{b \left (b \,{\mathrm e}^{2 i x}+2 a \,{\mathrm e}^{i x}+b \right )}+\frac {\ln \left ({\mathrm e}^{2 i x}+1+\frac {2 a \,{\mathrm e}^{i x}}{b}\right )}{b}\) \(67\)
norman \(\frac {2 x \tan \left (\frac {x}{2}\right )+2 x \tan \left (\frac {x}{2}\right )^{3}}{\left (1+\tan \left (\frac {x}{2}\right )^{2}\right ) \left (\tan \left (\frac {x}{2}\right )^{2} a -\tan \left (\frac {x}{2}\right )^{2} b +a +b \right )}+\frac {\ln \left (\tan \left (\frac {x}{2}\right )^{2} a -\tan \left (\frac {x}{2}\right )^{2} b +a +b \right )}{b}-\frac {\ln \left (1+\tan \left (\frac {x}{2}\right )^{2}\right )}{b}\) \(91\)

[In]

int(x*(b+a*cos(x))/(a+b*cos(x))^2,x,method=_RETURNVERBOSE)

[Out]

((a+b*cos(x))*ln((a+b*cos(x))/(cos(x)+1))+(-a-b*cos(x))*ln(1/(cos(x)+1))+b*x*sin(x))/b/(a+b*cos(x))

Fricas [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 36, normalized size of antiderivative = 1.50 \[ \int \frac {x (b+a \cos (x))}{(a+b \cos (x))^2} \, dx=\frac {b x \sin \left (x\right ) + {\left (b \cos \left (x\right ) + a\right )} \log \left (-b \cos \left (x\right ) - a\right )}{b^{2} \cos \left (x\right ) + a b} \]

[In]

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

[Out]

(b*x*sin(x) + (b*cos(x) + a)*log(-b*cos(x) - a))/(b^2*cos(x) + a*b)

Sympy [F(-1)]

Timed out. \[ \int \frac {x (b+a \cos (x))}{(a+b \cos (x))^2} \, dx=\text {Timed out} \]

[In]

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

[Out]

Timed out

Maxima [F(-2)]

Exception generated. \[ \int \frac {x (b+a \cos (x))}{(a+b \cos (x))^2} \, dx=\text {Exception raised: ValueError} \]

[In]

integrate(x*(b+a*cos(x))/(a+b*cos(x))^2,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*a^2-4*b^2>0)', see `assume?`
 for more de

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 397 vs. \(2 (24) = 48\).

Time = 0.36 (sec) , antiderivative size = 397, normalized size of antiderivative = 16.54 \[ \int \frac {x (b+a \cos (x))}{(a+b \cos (x))^2} \, dx=\frac {a \log \left (\frac {4 \, {\left (a^{2} \tan \left (\frac {1}{2} \, x\right )^{4} - 2 \, a b \tan \left (\frac {1}{2} \, x\right )^{4} + b^{2} \tan \left (\frac {1}{2} \, x\right )^{4} + 2 \, a^{2} \tan \left (\frac {1}{2} \, x\right )^{2} - 2 \, b^{2} \tan \left (\frac {1}{2} \, x\right )^{2} + a^{2} + 2 \, a b + b^{2}\right )}}{\tan \left (\frac {1}{2} \, x\right )^{4} + 2 \, \tan \left (\frac {1}{2} \, x\right )^{2} + 1}\right ) \tan \left (\frac {1}{2} \, x\right )^{2} - b \log \left (\frac {4 \, {\left (a^{2} \tan \left (\frac {1}{2} \, x\right )^{4} - 2 \, a b \tan \left (\frac {1}{2} \, x\right )^{4} + b^{2} \tan \left (\frac {1}{2} \, x\right )^{4} + 2 \, a^{2} \tan \left (\frac {1}{2} \, x\right )^{2} - 2 \, b^{2} \tan \left (\frac {1}{2} \, x\right )^{2} + a^{2} + 2 \, a b + b^{2}\right )}}{\tan \left (\frac {1}{2} \, x\right )^{4} + 2 \, \tan \left (\frac {1}{2} \, x\right )^{2} + 1}\right ) \tan \left (\frac {1}{2} \, x\right )^{2} + 8 \, b x \tan \left (\frac {1}{2} \, x\right ) + a \log \left (\frac {4 \, {\left (a^{2} \tan \left (\frac {1}{2} \, x\right )^{4} - 2 \, a b \tan \left (\frac {1}{2} \, x\right )^{4} + b^{2} \tan \left (\frac {1}{2} \, x\right )^{4} + 2 \, a^{2} \tan \left (\frac {1}{2} \, x\right )^{2} - 2 \, b^{2} \tan \left (\frac {1}{2} \, x\right )^{2} + a^{2} + 2 \, a b + b^{2}\right )}}{\tan \left (\frac {1}{2} \, x\right )^{4} + 2 \, \tan \left (\frac {1}{2} \, x\right )^{2} + 1}\right ) + b \log \left (\frac {4 \, {\left (a^{2} \tan \left (\frac {1}{2} \, x\right )^{4} - 2 \, a b \tan \left (\frac {1}{2} \, x\right )^{4} + b^{2} \tan \left (\frac {1}{2} \, x\right )^{4} + 2 \, a^{2} \tan \left (\frac {1}{2} \, x\right )^{2} - 2 \, b^{2} \tan \left (\frac {1}{2} \, x\right )^{2} + a^{2} + 2 \, a b + b^{2}\right )}}{\tan \left (\frac {1}{2} \, x\right )^{4} + 2 \, \tan \left (\frac {1}{2} \, x\right )^{2} + 1}\right )}{2 \, {\left (a b \tan \left (\frac {1}{2} \, x\right )^{2} - b^{2} \tan \left (\frac {1}{2} \, x\right )^{2} + a b + b^{2}\right )}} \]

[In]

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

[Out]

1/2*(a*log(4*(a^2*tan(1/2*x)^4 - 2*a*b*tan(1/2*x)^4 + b^2*tan(1/2*x)^4 + 2*a^2*tan(1/2*x)^2 - 2*b^2*tan(1/2*x)
^2 + a^2 + 2*a*b + b^2)/(tan(1/2*x)^4 + 2*tan(1/2*x)^2 + 1))*tan(1/2*x)^2 - b*log(4*(a^2*tan(1/2*x)^4 - 2*a*b*
tan(1/2*x)^4 + b^2*tan(1/2*x)^4 + 2*a^2*tan(1/2*x)^2 - 2*b^2*tan(1/2*x)^2 + a^2 + 2*a*b + b^2)/(tan(1/2*x)^4 +
 2*tan(1/2*x)^2 + 1))*tan(1/2*x)^2 + 8*b*x*tan(1/2*x) + a*log(4*(a^2*tan(1/2*x)^4 - 2*a*b*tan(1/2*x)^4 + b^2*t
an(1/2*x)^4 + 2*a^2*tan(1/2*x)^2 - 2*b^2*tan(1/2*x)^2 + a^2 + 2*a*b + b^2)/(tan(1/2*x)^4 + 2*tan(1/2*x)^2 + 1)
) + b*log(4*(a^2*tan(1/2*x)^4 - 2*a*b*tan(1/2*x)^4 + b^2*tan(1/2*x)^4 + 2*a^2*tan(1/2*x)^2 - 2*b^2*tan(1/2*x)^
2 + a^2 + 2*a*b + b^2)/(tan(1/2*x)^4 + 2*tan(1/2*x)^2 + 1)))/(a*b*tan(1/2*x)^2 - b^2*tan(1/2*x)^2 + a*b + b^2)

Mupad [B] (verification not implemented)

Time = 26.22 (sec) , antiderivative size = 68, normalized size of antiderivative = 2.83 \[ \int \frac {x (b+a \cos (x))}{(a+b \cos (x))^2} \, dx=\frac {\ln \left (b+2\,a\,{\mathrm {e}}^{x\,1{}\mathrm {i}}+b\,{\mathrm {e}}^{x\,2{}\mathrm {i}}\right )}{b}-\frac {x\,2{}\mathrm {i}}{b}+\frac {x\,2{}\mathrm {i}+\frac {a\,x\,{\mathrm {e}}^{x\,1{}\mathrm {i}}\,2{}\mathrm {i}}{b}}{b+2\,a\,{\mathrm {e}}^{x\,1{}\mathrm {i}}+b\,{\mathrm {e}}^{x\,2{}\mathrm {i}}} \]

[In]

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

[Out]

log(b + 2*a*exp(x*1i) + b*exp(x*2i))/b - (x*2i)/b + (x*2i + (a*x*exp(x*1i)*2i)/b)/(b + 2*a*exp(x*1i) + b*exp(x
*2i))