Integrand size = 48, antiderivative size = 55 \[ \int \frac {1-2 x+k^2 x^2}{\sqrt {(1-x) x \left (1-k^2 x\right )} \left (-1+2 x+\left (-2+k^2\right ) x^2\right )} \, dx=\frac {2 \arctan \left (\frac {\sqrt {-2+k^2} \sqrt {x+\left (-1-k^2\right ) x^2+k^2 x^3}}{-1+k^2 x}\right )}{\sqrt {-2+k^2}} \]
[Out]
Result contains higher order function than in optimal. Order 4 vs. order 3 in optimal.
Time = 3.63 (sec) , antiderivative size = 396, normalized size of antiderivative = 7.20, number of steps used = 12, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.125, Rules used = {6850, 6860, 116, 174, 552, 551} \[ \int \frac {1-2 x+k^2 x^2}{\sqrt {(1-x) x \left (1-k^2 x\right )} \left (-1+2 x+\left (-2+k^2\right ) x^2\right )} \, dx=-\frac {2 k^2 \sqrt {1-x} \sqrt {x} \sqrt {1-k^2 x} \operatorname {EllipticF}\left (\arcsin \left (\sqrt {x}\right ),k^2\right )}{\left (2-k^2\right ) \sqrt {(1-x) x \left (1-k^2 x\right )}}+\frac {2 \sqrt {k^2-1} \left (k^2+2 \sqrt {k^2-1}\right ) \sqrt {1-x} \sqrt {x} \sqrt {\frac {k^2 (1-x)}{1-k^2}+1} \operatorname {EllipticPi}\left (\frac {2-k^2}{-k^2-\sqrt {k^2-1}+1},\arcsin \left (\sqrt {1-x}\right ),-\frac {k^2}{1-k^2}\right )}{\left (2-k^2\right ) \left (-k^2-\sqrt {k^2-1}+1\right ) \sqrt {(1-x) x \left (1-k^2 x\right )}}-\frac {2 \sqrt {k^2-1} \left (k^2-2 \sqrt {k^2-1}\right ) \sqrt {1-x} \sqrt {x} \sqrt {\frac {k^2 (1-x)}{1-k^2}+1} \operatorname {EllipticPi}\left (\frac {2-k^2}{-k^2+\sqrt {k^2-1}+1},\arcsin \left (\sqrt {1-x}\right ),-\frac {k^2}{1-k^2}\right )}{\left (2-k^2\right ) \left (-k^2+\sqrt {k^2-1}+1\right ) \sqrt {(1-x) x \left (1-k^2 x\right )}} \]
[In]
[Out]
Rule 116
Rule 174
Rule 551
Rule 552
Rule 6850
Rule 6860
Rubi steps \begin{align*} \text {integral}& = \frac {\left (\sqrt {1-x} \sqrt {x} \sqrt {1-k^2 x}\right ) \int \frac {1-2 x+k^2 x^2}{\sqrt {1-x} \sqrt {x} \sqrt {1-k^2 x} \left (-1+2 x+\left (-2+k^2\right ) x^2\right )} \, dx}{\sqrt {(1-x) x \left (1-k^2 x\right )}} \\ & = \frac {\left (\sqrt {1-x} \sqrt {x} \sqrt {1-k^2 x}\right ) \int \left (-\frac {k^2}{\left (2-k^2\right ) \sqrt {1-x} \sqrt {x} \sqrt {1-k^2 x}}+\frac {2 \left (-1+k^2\right ) (1-2 x)}{\left (-2+k^2\right ) \sqrt {1-x} \sqrt {x} \sqrt {1-k^2 x} \left (-1+2 x+\left (-2+k^2\right ) x^2\right )}\right ) \, dx}{\sqrt {(1-x) x \left (1-k^2 x\right )}} \\ & = -\frac {\left (k^2 \sqrt {1-x} \sqrt {x} \sqrt {1-k^2 x}\right ) \int \frac {1}{\sqrt {1-x} \sqrt {x} \sqrt {1-k^2 x}} \, dx}{\left (2-k^2\right ) \sqrt {(1-x) x \left (1-k^2 x\right )}}+\frac {\left (2 \left (1-k^2\right ) \sqrt {1-x} \sqrt {x} \sqrt {1-k^2 x}\right ) \int \frac {1-2 x}{\sqrt {1-x} \sqrt {x} \sqrt {1-k^2 x} \left (-1+2 x+\left (-2+k^2\right ) x^2\right )} \, dx}{\left (2-k^2\right ) \sqrt {(1-x) x \left (1-k^2 x\right )}} \\ & = -\frac {2 k^2 \sqrt {1-x} \sqrt {x} \sqrt {1-k^2 x} \operatorname {EllipticF}\left (\arcsin \left (\sqrt {x}\right ),k^2\right )}{\left (2-k^2\right ) \sqrt {(1-x) x \left (1-k^2 x\right )}}+\frac {\left (2 \left (1-k^2\right ) \sqrt {1-x} \sqrt {x} \sqrt {1-k^2 x}\right ) \int \left (\frac {-2+\frac {k^2}{\sqrt {-1+k^2}}}{\sqrt {1-x} \sqrt {x} \sqrt {1-k^2 x} \left (2-2 \sqrt {-1+k^2}+2 \left (-2+k^2\right ) x\right )}+\frac {-2-\frac {k^2}{\sqrt {-1+k^2}}}{\sqrt {1-x} \sqrt {x} \sqrt {1-k^2 x} \left (2+2 \sqrt {-1+k^2}+2 \left (-2+k^2\right ) x\right )}\right ) \, dx}{\left (2-k^2\right ) \sqrt {(1-x) x \left (1-k^2 x\right )}} \\ & = -\frac {2 k^2 \sqrt {1-x} \sqrt {x} \sqrt {1-k^2 x} \operatorname {EllipticF}\left (\arcsin \left (\sqrt {x}\right ),k^2\right )}{\left (2-k^2\right ) \sqrt {(1-x) x \left (1-k^2 x\right )}}+\frac {\left (2 \left (1-k^2\right ) \left (-2-\frac {k^2}{\sqrt {-1+k^2}}\right ) \sqrt {1-x} \sqrt {x} \sqrt {1-k^2 x}\right ) \int \frac {1}{\sqrt {1-x} \sqrt {x} \sqrt {1-k^2 x} \left (2+2 \sqrt {-1+k^2}+2 \left (-2+k^2\right ) x\right )} \, dx}{\left (2-k^2\right ) \sqrt {(1-x) x \left (1-k^2 x\right )}}+\frac {\left (2 \left (1-k^2\right ) \left (-2+\frac {k^2}{\sqrt {-1+k^2}}\right ) \sqrt {1-x} \sqrt {x} \sqrt {1-k^2 x}\right ) \int \frac {1}{\sqrt {1-x} \sqrt {x} \sqrt {1-k^2 x} \left (2-2 \sqrt {-1+k^2}+2 \left (-2+k^2\right ) x\right )} \, dx}{\left (2-k^2\right ) \sqrt {(1-x) x \left (1-k^2 x\right )}} \\ & = -\frac {2 k^2 \sqrt {1-x} \sqrt {x} \sqrt {1-k^2 x} \operatorname {EllipticF}\left (\arcsin \left (\sqrt {x}\right ),k^2\right )}{\left (2-k^2\right ) \sqrt {(1-x) x \left (1-k^2 x\right )}}-\frac {\left (4 \left (1-k^2\right ) \left (-2-\frac {k^2}{\sqrt {-1+k^2}}\right ) \sqrt {1-x} \sqrt {x} \sqrt {1-k^2 x}\right ) \text {Subst}\left (\int \frac {1}{\sqrt {1-x^2} \sqrt {1-k^2+k^2 x^2} \left (-2 \left (1-k^2-\sqrt {-1+k^2}\right )+2 \left (2-k^2\right ) x^2\right )} \, dx,x,\sqrt {1-x}\right )}{\left (2-k^2\right ) \sqrt {(1-x) x \left (1-k^2 x\right )}}-\frac {\left (4 \left (1-k^2\right ) \left (-2+\frac {k^2}{\sqrt {-1+k^2}}\right ) \sqrt {1-x} \sqrt {x} \sqrt {1-k^2 x}\right ) \text {Subst}\left (\int \frac {1}{\sqrt {1-x^2} \sqrt {1-k^2+k^2 x^2} \left (-2 \left (1-k^2+\sqrt {-1+k^2}\right )+2 \left (2-k^2\right ) x^2\right )} \, dx,x,\sqrt {1-x}\right )}{\left (2-k^2\right ) \sqrt {(1-x) x \left (1-k^2 x\right )}} \\ & = -\frac {2 k^2 \sqrt {1-x} \sqrt {x} \sqrt {1-k^2 x} \operatorname {EllipticF}\left (\arcsin \left (\sqrt {x}\right ),k^2\right )}{\left (2-k^2\right ) \sqrt {(1-x) x \left (1-k^2 x\right )}}-\frac {\left (4 \left (1-k^2\right ) \left (-2-\frac {k^2}{\sqrt {-1+k^2}}\right ) \sqrt {1+\frac {k^2 (-1+x)}{-1+k^2}} \sqrt {1-x} \sqrt {x}\right ) \text {Subst}\left (\int \frac {1}{\sqrt {1-x^2} \sqrt {1+\frac {k^2 x^2}{1-k^2}} \left (-2 \left (1-k^2-\sqrt {-1+k^2}\right )+2 \left (2-k^2\right ) x^2\right )} \, dx,x,\sqrt {1-x}\right )}{\left (2-k^2\right ) \sqrt {(1-x) x \left (1-k^2 x\right )}}-\frac {\left (4 \left (1-k^2\right ) \left (-2+\frac {k^2}{\sqrt {-1+k^2}}\right ) \sqrt {1+\frac {k^2 (-1+x)}{-1+k^2}} \sqrt {1-x} \sqrt {x}\right ) \text {Subst}\left (\int \frac {1}{\sqrt {1-x^2} \sqrt {1+\frac {k^2 x^2}{1-k^2}} \left (-2 \left (1-k^2+\sqrt {-1+k^2}\right )+2 \left (2-k^2\right ) x^2\right )} \, dx,x,\sqrt {1-x}\right )}{\left (2-k^2\right ) \sqrt {(1-x) x \left (1-k^2 x\right )}} \\ & = -\frac {2 k^2 \sqrt {1-x} \sqrt {x} \sqrt {1-k^2 x} \operatorname {EllipticF}\left (\arcsin \left (\sqrt {x}\right ),k^2\right )}{\left (2-k^2\right ) \sqrt {(1-x) x \left (1-k^2 x\right )}}+\frac {2 \sqrt {-1+k^2} \left (k^2+2 \sqrt {-1+k^2}\right ) \sqrt {1+\frac {k^2 (1-x)}{1-k^2}} \sqrt {1-x} \sqrt {x} \operatorname {EllipticPi}\left (\frac {2-k^2}{1-k^2-\sqrt {-1+k^2}},\arcsin \left (\sqrt {1-x}\right ),-\frac {k^2}{1-k^2}\right )}{\left (2-k^2\right ) \left (1-k^2-\sqrt {-1+k^2}\right ) \sqrt {(1-x) x \left (1-k^2 x\right )}}-\frac {2 \left (2-k^2 \left (2-\sqrt {-1+k^2}\right )\right ) \sqrt {1+\frac {k^2 (1-x)}{1-k^2}} \sqrt {1-x} \sqrt {x} \operatorname {EllipticPi}\left (\frac {2-k^2}{1-k^2+\sqrt {-1+k^2}},\arcsin \left (\sqrt {1-x}\right ),-\frac {k^2}{1-k^2}\right )}{\left (2-k^2\right ) \left (1-k^2+\sqrt {-1+k^2}\right ) \sqrt {(1-x) x \left (1-k^2 x\right )}} \\ \end{align*}
Time = 15.19 (sec) , antiderivative size = 42, normalized size of antiderivative = 0.76 \[ \int \frac {1-2 x+k^2 x^2}{\sqrt {(1-x) x \left (1-k^2 x\right )} \left (-1+2 x+\left (-2+k^2\right ) x^2\right )} \, dx=\frac {2 \arctan \left (\frac {\sqrt {-2+k^2} (-1+x) x}{\sqrt {(-1+x) x \left (-1+k^2 x\right )}}\right )}{\sqrt {-2+k^2}} \]
[In]
[Out]
Result contains higher order function than in optimal. Order 4 vs. order 3.
Time = 1.43 (sec) , antiderivative size = 2704, normalized size of antiderivative = 49.16
method | result | size |
default | \(\text {Expression too large to display}\) | \(2704\) |
elliptic | \(\text {Expression too large to display}\) | \(2727\) |
[In]
[Out]
none
Time = 0.32 (sec) , antiderivative size = 269, normalized size of antiderivative = 4.89 \[ \int \frac {1-2 x+k^2 x^2}{\sqrt {(1-x) x \left (1-k^2 x\right )} \left (-1+2 x+\left (-2+k^2\right ) x^2\right )} \, dx=\left [-\frac {\sqrt {-k^{2} + 2} \log \left (\frac {{\left (k^{4} - 4 \, k^{2} + 4\right )} x^{4} - 4 \, {\left (2 \, k^{4} - 5 \, k^{2} + 2\right )} x^{3} + 2 \, {\left (4 \, k^{4} - 5 \, k^{2} - 4\right )} x^{2} - 4 \, \sqrt {k^{2} x^{3} - {\left (k^{2} + 1\right )} x^{2} + x} {\left ({\left (k^{2} - 2\right )} x^{2} - 2 \, {\left (k^{2} - 1\right )} x + 1\right )} \sqrt {-k^{2} + 2} - 4 \, {\left (2 \, k^{2} - 3\right )} x + 1}{{\left (k^{4} - 4 \, k^{2} + 4\right )} x^{4} + 4 \, {\left (k^{2} - 2\right )} x^{3} - 2 \, {\left (k^{2} - 4\right )} x^{2} - 4 \, x + 1}\right )}{2 \, {\left (k^{2} - 2\right )}}, \frac {\arctan \left (\frac {\sqrt {k^{2} x^{3} - {\left (k^{2} + 1\right )} x^{2} + x} {\left ({\left (k^{2} - 2\right )} x^{2} - 2 \, {\left (k^{2} - 1\right )} x + 1\right )} \sqrt {k^{2} - 2}}{2 \, {\left ({\left (k^{4} - 2 \, k^{2}\right )} x^{3} - {\left (k^{4} - k^{2} - 2\right )} x^{2} + {\left (k^{2} - 2\right )} x\right )}}\right )}{\sqrt {k^{2} - 2}}\right ] \]
[In]
[Out]
Timed out. \[ \int \frac {1-2 x+k^2 x^2}{\sqrt {(1-x) x \left (1-k^2 x\right )} \left (-1+2 x+\left (-2+k^2\right ) x^2\right )} \, dx=\text {Timed out} \]
[In]
[Out]
Exception generated. \[ \int \frac {1-2 x+k^2 x^2}{\sqrt {(1-x) x \left (1-k^2 x\right )} \left (-1+2 x+\left (-2+k^2\right ) x^2\right )} \, dx=\text {Exception raised: ValueError} \]
[In]
[Out]
\[ \int \frac {1-2 x+k^2 x^2}{\sqrt {(1-x) x \left (1-k^2 x\right )} \left (-1+2 x+\left (-2+k^2\right ) x^2\right )} \, dx=\int { \frac {k^{2} x^{2} - 2 \, x + 1}{\sqrt {{\left (k^{2} x - 1\right )} {\left (x - 1\right )} x} {\left ({\left (k^{2} - 2\right )} x^{2} + 2 \, x - 1\right )}} \,d x } \]
[In]
[Out]
Time = 8.03 (sec) , antiderivative size = 84, normalized size of antiderivative = 1.53 \[ \int \frac {1-2 x+k^2 x^2}{\sqrt {(1-x) x \left (1-k^2 x\right )} \left (-1+2 x+\left (-2+k^2\right ) x^2\right )} \, dx=\frac {\ln \left (\frac {x\,2{}\mathrm {i}+k^2\,x^2\,1{}\mathrm {i}-k^2\,x\,2{}\mathrm {i}-x^2\,2{}\mathrm {i}-2\,\sqrt {k^2-2}\,\sqrt {x\,\left (k^2\,x-1\right )\,\left (x-1\right )}+1{}\mathrm {i}}{2\,k^2\,x^2-4\,x^2+4\,x-2}\right )\,1{}\mathrm {i}}{\sqrt {k^2-2}} \]
[In]
[Out]