### 3.2235 $$\int \frac{2 ((\frac{a}{b})^{\frac{1}{n}}-x \cos (\frac{(-1+2 k) \pi }{n}))}{(\frac{a}{b})^{2/n}+x^2-2 (\frac{a}{b})^{\frac{1}{n}} x \cos (\frac{(-1+2 k) \pi }{n})} \, dx$$

Optimal. Leaf size=114 $2 \sin \left (\frac{\pi -2 \pi k}{n}\right ) \tan ^{-1}\left (\left (\frac{a}{b}\right )^{-1/n} \csc \left (\frac{\pi -2 \pi k}{n}\right ) \left (x-\left (\frac{a}{b}\right )^{\frac{1}{n}} \cos \left (\frac{\pi -2 \pi k}{n}\right )\right )\right )-\cos \left (\frac{\pi -2 \pi k}{n}\right ) \log \left (-2 x \left (\frac{a}{b}\right )^{\frac{1}{n}} \cos \left (\frac{\pi -2 \pi k}{n}\right )+\left (\frac{a}{b}\right )^{2/n}+x^2\right )$

[Out]

-(Cos[(Pi - 2*k*Pi)/n]*Log[(a/b)^(2/n) + x^2 - 2*(a/b)^n^(-1)*x*Cos[(Pi - 2*k*Pi)/n]]) + 2*ArcTan[((x - (a/b)^
n^(-1)*Cos[(Pi - 2*k*Pi)/n])*Csc[(Pi - 2*k*Pi)/n])/(a/b)^n^(-1)]*Sin[(Pi - 2*k*Pi)/n]

________________________________________________________________________________________

Rubi [A]  time = 0.261596, antiderivative size = 114, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 5, integrand size = 66, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.076, Rules used = {12, 634, 618, 204, 628} $2 \sin \left (\frac{\pi -2 \pi k}{n}\right ) \tan ^{-1}\left (\left (\frac{a}{b}\right )^{-1/n} \csc \left (\frac{\pi -2 \pi k}{n}\right ) \left (x-\left (\frac{a}{b}\right )^{\frac{1}{n}} \cos \left (\frac{\pi -2 \pi k}{n}\right )\right )\right )-\cos \left (\frac{\pi -2 \pi k}{n}\right ) \log \left (-2 x \left (\frac{a}{b}\right )^{\frac{1}{n}} \cos \left (\frac{\pi -2 \pi k}{n}\right )+\left (\frac{a}{b}\right )^{2/n}+x^2\right )$

Antiderivative was successfully veriﬁed.

[In]

Int[(2*((a/b)^n^(-1) - x*Cos[((-1 + 2*k)*Pi)/n]))/((a/b)^(2/n) + x^2 - 2*(a/b)^n^(-1)*x*Cos[((-1 + 2*k)*Pi)/n]
),x]

[Out]

-(Cos[(Pi - 2*k*Pi)/n]*Log[(a/b)^(2/n) + x^2 - 2*(a/b)^n^(-1)*x*Cos[(Pi - 2*k*Pi)/n]]) + 2*ArcTan[((x - (a/b)^
n^(-1)*Cos[(Pi - 2*k*Pi)/n])*Csc[(Pi - 2*k*Pi)/n])/(a/b)^n^(-1)]*Sin[(Pi - 2*k*Pi)/n]

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

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 204

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> -Simp[ArcTan[(Rt[-b, 2]*x)/Rt[-a, 2]]/(Rt[-a, 2]*Rt[-b, 2]), x] /
; FreeQ[{a, b}, x] && PosQ[a/b] && (LtQ[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]

Rubi steps

\begin{align*} \int \frac{2 \left (\left (\frac{a}{b}\right )^{\frac{1}{n}}-x \cos \left (\frac{(-1+2 k) \pi }{n}\right )\right )}{\left (\frac{a}{b}\right )^{2/n}+x^2-2 \left (\frac{a}{b}\right )^{\frac{1}{n}} x \cos \left (\frac{(-1+2 k) \pi }{n}\right )} \, dx &=2 \int \frac{\left (\frac{a}{b}\right )^{\frac{1}{n}}-x \cos \left (\frac{(-1+2 k) \pi }{n}\right )}{\left (\frac{a}{b}\right )^{2/n}+x^2-2 \left (\frac{a}{b}\right )^{\frac{1}{n}} x \cos \left (\frac{(-1+2 k) \pi }{n}\right )} \, dx\\ &=-\left (\cos \left (\frac{(-1+2 k) \pi }{n}\right ) \int \frac{2 x-2 \left (\frac{a}{b}\right )^{\frac{1}{n}} \cos \left (\frac{(-1+2 k) \pi }{n}\right )}{\left (\frac{a}{b}\right )^{2/n}+x^2-2 \left (\frac{a}{b}\right )^{\frac{1}{n}} x \cos \left (\frac{(-1+2 k) \pi }{n}\right )} \, dx\right )+\left (2 \left (\frac{a}{b}\right )^{\frac{1}{n}}-2 \left (\frac{a}{b}\right )^{\frac{1}{n}} \cos ^2\left (\frac{(-1+2 k) \pi }{n}\right )\right ) \int \frac{1}{\left (\frac{a}{b}\right )^{2/n}+x^2-2 \left (\frac{a}{b}\right )^{\frac{1}{n}} x \cos \left (\frac{(-1+2 k) \pi }{n}\right )} \, dx\\ &=-\cos \left (\frac{(1-2 k) \pi }{n}\right ) \log \left (\left (\frac{a}{b}\right )^{2/n}+x^2-2 \left (\frac{a}{b}\right )^{\frac{1}{n}} x \cos \left (\frac{\pi -2 k \pi }{n}\right )\right )+\left (2 \left (-2 \left (\frac{a}{b}\right )^{\frac{1}{n}}+2 \left (\frac{a}{b}\right )^{\frac{1}{n}} \cos ^2\left (\frac{(-1+2 k) \pi }{n}\right )\right )\right ) \operatorname{Subst}\left (\int \frac{1}{-x^2-4 \left (\frac{a}{b}\right )^{2/n} \sin ^2\left (\frac{(1-2 k) \pi }{n}\right )} \, dx,x,2 x-2 \left (\frac{a}{b}\right )^{\frac{1}{n}} \cos \left (\frac{(-1+2 k) \pi }{n}\right )\right )\\ &=-\cos \left (\frac{(1-2 k) \pi }{n}\right ) \log \left (\left (\frac{a}{b}\right )^{2/n}+x^2-2 \left (\frac{a}{b}\right )^{\frac{1}{n}} x \cos \left (\frac{\pi -2 k \pi }{n}\right )\right )+2 \tan ^{-1}\left (\left (\frac{a}{b}\right )^{-1/n} \left (x-\left (\frac{a}{b}\right )^{\frac{1}{n}} \cos \left (\frac{(1-2 k) \pi }{n}\right )\right ) \csc \left (\frac{\pi -2 k \pi }{n}\right )\right ) \csc \left (\frac{\pi -2 k \pi }{n}\right ) \sin ^2\left (\frac{(1-2 k) \pi }{n}\right )\\ \end{align*}

Mathematica [A]  time = 0.0716779, size = 111, normalized size = 0.97 $2 \left (\sin \left (\frac{\pi (2 k-1)}{n}\right ) \tan ^{-1}\left (\frac{\tan \left (\frac{\pi (2 k-1)}{2 n}\right ) \left (\left (\frac{a}{b}\right )^{\frac{1}{n}}+x\right )}{\left (\frac{a}{b}\right )^{\frac{1}{n}}-x}\right )-\frac{1}{2} \cos \left (\frac{\pi (2 k-1)}{n}\right ) \log \left (-2 x \left (\frac{a}{b}\right )^{\frac{1}{n}} \cos \left (\frac{\pi (2 k-1)}{n}\right )+\left (\frac{a}{b}\right )^{2/n}+x^2\right )\right )$

Antiderivative was successfully veriﬁed.

[In]

Integrate[(2*((a/b)^n^(-1) - x*Cos[((-1 + 2*k)*Pi)/n]))/((a/b)^(2/n) + x^2 - 2*(a/b)^n^(-1)*x*Cos[((-1 + 2*k)*
Pi)/n]),x]

[Out]

2*(-(Cos[((-1 + 2*k)*Pi)/n]*Log[(a/b)^(2/n) + x^2 - 2*(a/b)^n^(-1)*x*Cos[((-1 + 2*k)*Pi)/n]])/2 + ArcTan[(((a/
b)^n^(-1) + x)*Tan[((-1 + 2*k)*Pi)/(2*n)])/((a/b)^n^(-1) - x)]*Sin[((-1 + 2*k)*Pi)/n])

________________________________________________________________________________________

Maple [B]  time = 0.274, size = 311, normalized size = 2.7 \begin{align*} -\cos \left ({\frac{ \left ( 2\,k-1 \right ) \pi }{n}} \right ) \ln \left ( 2\,\sqrt [n]{{\frac{a}{b}}}x\cos \left ({\frac{ \left ( 2\,k-1 \right ) \pi }{n}} \right ) -{x}^{2}- \left ({\frac{a}{b}} \right ) ^{2\,{n}^{-1}} \right ) +2\,{\arctan \left ( 1/2\,{ \left ( 2\,\sqrt [n]{{\frac{a}{b}}}\cos \left ({\frac{ \left ( 2\,k-1 \right ) \pi }{n}} \right ) -2\,x \right ){\frac{1}{\sqrt{ \left ({\frac{a}{b}} \right ) ^{2\,{n}^{-1}}- \left ( \sqrt [n]{{\frac{a}{b}}} \right ) ^{2} \left ( \cos \left ({\frac{ \left ( 2\,k-1 \right ) \pi }{n}} \right ) \right ) ^{2}}}}} \right ) \left ( \cos \left ({\frac{ \left ( 2\,k-1 \right ) \pi }{n}} \right ) \right ) ^{2}\sqrt [n]{{\frac{a}{b}}}{\frac{1}{\sqrt{ \left ({\frac{a}{b}} \right ) ^{2\,{n}^{-1}}- \left ( \sqrt [n]{{\frac{a}{b}}} \right ) ^{2} \left ( \cos \left ({\frac{ \left ( 2\,k-1 \right ) \pi }{n}} \right ) \right ) ^{2}}}}}-2\,{\arctan \left ( 1/2\,{ \left ( 2\,\sqrt [n]{{\frac{a}{b}}}\cos \left ({\frac{ \left ( 2\,k-1 \right ) \pi }{n}} \right ) -2\,x \right ){\frac{1}{\sqrt{ \left ({\frac{a}{b}} \right ) ^{2\,{n}^{-1}}- \left ( \sqrt [n]{{\frac{a}{b}}} \right ) ^{2} \left ( \cos \left ({\frac{ \left ( 2\,k-1 \right ) \pi }{n}} \right ) \right ) ^{2}}}}} \right ) \sqrt [n]{{\frac{a}{b}}}{\frac{1}{\sqrt{ \left ({\frac{a}{b}} \right ) ^{2\,{n}^{-1}}- \left ( \sqrt [n]{{\frac{a}{b}}} \right ) ^{2} \left ( \cos \left ({\frac{ \left ( 2\,k-1 \right ) \pi }{n}} \right ) \right ) ^{2}}}}} \end{align*}

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

[In]

int(2*((1/b*a)^(1/n)-x*cos(Pi*(2*k-1)/n))/((1/b*a)^(2/n)+x^2-2*(1/b*a)^(1/n)*x*cos(Pi*(2*k-1)/n)),x)

[Out]

-cos(Pi*(2*k-1)/n)*ln(2*(1/b*a)^(1/n)*x*cos(Pi*(2*k-1)/n)-x^2-(1/b*a)^(2/n))+2/((1/b*a)^(2/n)-((1/b*a)^(1/n))^
2*cos(Pi*(2*k-1)/n)^2)^(1/2)*arctan(1/2*(2*(1/b*a)^(1/n)*cos(Pi*(2*k-1)/n)-2*x)/((1/b*a)^(2/n)-((1/b*a)^(1/n))
^2*cos(Pi*(2*k-1)/n)^2)^(1/2))*cos(Pi*(2*k-1)/n)^2*(1/b*a)^(1/n)-2/((1/b*a)^(2/n)-((1/b*a)^(1/n))^2*cos(Pi*(2*
k-1)/n)^2)^(1/2)*arctan(1/2*(2*(1/b*a)^(1/n)*cos(Pi*(2*k-1)/n)-2*x)/((1/b*a)^(2/n)-((1/b*a)^(1/n))^2*cos(Pi*(2
*k-1)/n)^2)^(1/2))*(1/b*a)^(1/n)

________________________________________________________________________________________

Maxima [A]  time = 1.50017, size = 282, normalized size = 2.47 \begin{align*} -\cos \left (\frac{2 \, \pi k}{n} - \frac{\pi }{n}\right ) \log \left (-2 \, x \left (\frac{a}{b}\right )^{\left (\frac{1}{n}\right )} \cos \left (\frac{2 \, \pi k}{n} - \frac{\pi }{n}\right ) + x^{2} + \left (\frac{a}{b}\right )^{\frac{2}{n}}\right ) - \sqrt{\cos \left (\frac{2 \, \pi k}{n} - \frac{\pi }{n}\right )^{2} - 1} \log \left (\frac{\left (\frac{a}{b}\right )^{\left (\frac{1}{n}\right )} \cos \left (\frac{2 \, \pi k}{n} - \frac{\pi }{n}\right ) + \sqrt{\cos \left (\frac{2 \, \pi k}{n} - \frac{\pi }{n}\right )^{2} - 1} \left (\frac{a}{b}\right )^{\left (\frac{1}{n}\right )} - x}{\left (\frac{a}{b}\right )^{\left (\frac{1}{n}\right )} \cos \left (\frac{2 \, \pi k}{n} - \frac{\pi }{n}\right ) - \sqrt{\cos \left (\frac{2 \, \pi k}{n} - \frac{\pi }{n}\right )^{2} - 1} \left (\frac{a}{b}\right )^{\left (\frac{1}{n}\right )} - x}\right ) \end{align*}

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

[In]

integrate(2*((a/b)^(1/n)-x*cos((-1+2*k)*pi/n))/((a/b)^(2/n)+x^2-2*(a/b)^(1/n)*x*cos((-1+2*k)*pi/n)),x, algorit
hm="maxima")

[Out]

-cos(2*pi*k/n - pi/n)*log(-2*x*(a/b)^(1/n)*cos(2*pi*k/n - pi/n) + x^2 + (a/b)^(2/n)) - sqrt(cos(2*pi*k/n - pi/
n)^2 - 1)*log(((a/b)^(1/n)*cos(2*pi*k/n - pi/n) + sqrt(cos(2*pi*k/n - pi/n)^2 - 1)*(a/b)^(1/n) - x)/((a/b)^(1/
n)*cos(2*pi*k/n - pi/n) - sqrt(cos(2*pi*k/n - pi/n)^2 - 1)*(a/b)^(1/n) - x))

________________________________________________________________________________________

Fricas [A]  time = 2.57633, size = 302, normalized size = 2.65 \begin{align*} -\cos \left (\frac{2 \, \pi k}{n} - \frac{\pi }{n}\right ) \log \left (-\frac{2 \,{\left (2 \, x \left (\frac{a}{b}\right )^{\left (\frac{1}{n}\right )} \cos \left (\frac{2 \, \pi k}{n} - \frac{\pi }{n}\right ) - x^{2} - \left (\frac{a}{b}\right )^{\frac{2}{n}}\right )}}{\cos \left (\frac{2 \, \pi k}{n} - \frac{\pi }{n}\right ) + 1}\right ) - 2 \, \arctan \left (\frac{\left (\frac{a}{b}\right )^{\left (\frac{1}{n}\right )} \cos \left (\frac{2 \, \pi k}{n} - \frac{\pi }{n}\right ) - x}{\left (\frac{a}{b}\right )^{\left (\frac{1}{n}\right )} \sin \left (\frac{2 \, \pi k}{n} - \frac{\pi }{n}\right )}\right ) \sin \left (\frac{2 \, \pi k}{n} - \frac{\pi }{n}\right ) \end{align*}

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

[In]

integrate(2*((a/b)^(1/n)-x*cos((-1+2*k)*pi/n))/((a/b)^(2/n)+x^2-2*(a/b)^(1/n)*x*cos((-1+2*k)*pi/n)),x, algorit
hm="fricas")

[Out]

-cos(2*pi*k/n - pi/n)*log(-2*(2*x*(a/b)^(1/n)*cos(2*pi*k/n - pi/n) - x^2 - (a/b)^(2/n))/(cos(2*pi*k/n - pi/n)
+ 1)) - 2*arctan(((a/b)^(1/n)*cos(2*pi*k/n - pi/n) - x)/((a/b)^(1/n)*sin(2*pi*k/n - pi/n)))*sin(2*pi*k/n - pi/
n)

________________________________________________________________________________________

Sympy [A]  time = 1.07647, size = 177, normalized size = 1.55 \begin{align*} - \left (- \sqrt{\left (\cos{\left (\frac{\pi \left (2 k - 1\right )}{n} \right )} - 1\right ) \left (\cos{\left (\frac{\pi \left (2 k - 1\right )}{n} \right )} + 1\right )} + \cos{\left (\frac{2 \pi k}{n} - \frac{\pi }{n} \right )}\right ) \log{\left (x - \left (\frac{a}{b}\right )^{\frac{1}{n}} \left (- \sqrt{\left (\cos{\left (\frac{\pi \left (2 k - 1\right )}{n} \right )} - 1\right ) \left (\cos{\left (\frac{\pi \left (2 k - 1\right )}{n} \right )} + 1\right )} + \cos{\left (\frac{2 \pi k}{n} - \frac{\pi }{n} \right )}\right ) \right )} - \left (\sqrt{\left (\cos{\left (\frac{\pi \left (2 k - 1\right )}{n} \right )} - 1\right ) \left (\cos{\left (\frac{\pi \left (2 k - 1\right )}{n} \right )} + 1\right )} + \cos{\left (\frac{2 \pi k}{n} - \frac{\pi }{n} \right )}\right ) \log{\left (x - \left (\frac{a}{b}\right )^{\frac{1}{n}} \left (\sqrt{\left (\cos{\left (\frac{\pi \left (2 k - 1\right )}{n} \right )} - 1\right ) \left (\cos{\left (\frac{\pi \left (2 k - 1\right )}{n} \right )} + 1\right )} + \cos{\left (\frac{2 \pi k}{n} - \frac{\pi }{n} \right )}\right ) \right )} \end{align*}

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

[In]

integrate(2*((a/b)**(1/n)-x*cos((-1+2*k)*pi/n))/((a/b)**(2/n)+x**2-2*(a/b)**(1/n)*x*cos((-1+2*k)*pi/n)),x)

[Out]

-(-sqrt((cos(pi*(2*k - 1)/n) - 1)*(cos(pi*(2*k - 1)/n) + 1)) + cos(2*pi*k/n - pi/n))*log(x - (a/b)**(1/n)*(-sq
rt((cos(pi*(2*k - 1)/n) - 1)*(cos(pi*(2*k - 1)/n) + 1)) + cos(2*pi*k/n - pi/n))) - (sqrt((cos(pi*(2*k - 1)/n)
- 1)*(cos(pi*(2*k - 1)/n) + 1)) + cos(2*pi*k/n - pi/n))*log(x - (a/b)**(1/n)*(sqrt((cos(pi*(2*k - 1)/n) - 1)*(
cos(pi*(2*k - 1)/n) + 1)) + cos(2*pi*k/n - pi/n)))

________________________________________________________________________________________

Giac [A]  time = 1.19875, size = 273, normalized size = 2.39 \begin{align*} -\cos \left (\frac{2 \, \pi k}{n} - \frac{\pi }{n}\right ) \log \left (-2 \, x \left (\frac{a}{b}\right )^{\left (\frac{1}{n}\right )} \cos \left (\frac{2 \, \pi k}{n} - \frac{\pi }{n}\right ) + x^{2} + \left (\frac{a}{b}\right )^{\frac{2}{n}}\right ) - \frac{2 \,{\left (\left (\frac{a}{b}\right )^{\left (\frac{1}{n}\right )} \cos \left (\frac{2 \, \pi k}{n} - \frac{\pi }{n}\right )^{2} - \left (\frac{a}{b}\right )^{\left (\frac{1}{n}\right )}\right )} \arctan \left (-\frac{\left (\frac{a}{b}\right )^{\left (\frac{1}{n}\right )} \cos \left (\frac{2 \, \pi k}{n} - \frac{\pi }{n}\right ) - x}{\sqrt{-\cos \left (\frac{2 \, \pi k}{n} - \frac{\pi }{n}\right )^{2} + 1} \left (\frac{a}{b}\right )^{\left (\frac{1}{n}\right )}}\right )}{\sqrt{-\cos \left (\frac{2 \, \pi k}{n} - \frac{\pi }{n}\right )^{2} + 1} \left (\frac{a}{b}\right )^{\left (\frac{1}{n}\right )}} \end{align*}

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

[In]

integrate(2*((a/b)^(1/n)-x*cos((-1+2*k)*pi/n))/((a/b)^(2/n)+x^2-2*(a/b)^(1/n)*x*cos((-1+2*k)*pi/n)),x, algorit
hm="giac")

[Out]

-cos(2*pi*k/n - pi/n)*log(-2*x*(a/b)^(1/n)*cos(2*pi*k/n - pi/n) + x^2 + (a/b)^(2/n)) - 2*((a/b)^(1/n)*cos(2*pi
*k/n - pi/n)^2 - (a/b)^(1/n))*arctan(-((a/b)^(1/n)*cos(2*pi*k/n - pi/n) - x)/(sqrt(-cos(2*pi*k/n - pi/n)^2 + 1
)*(a/b)^(1/n)))/(sqrt(-cos(2*pi*k/n - pi/n)^2 + 1)*(a/b)^(1/n))