### 3.2587 $$\int (1-x)^p (1+x+x^2)^p \, dx$$

Optimal. Leaf size=41 $x (1-x)^p \left (x^2+x+1\right )^p \left (1-x^3\right )^{-p} \, _2F_1\left (\frac{1}{3},-p;\frac{4}{3};x^3\right )$

[Out]

((1 - x)^p*x*(1 + x + x^2)^p*Hypergeometric2F1[1/3, -p, 4/3, x^3])/(1 - x^3)^p

________________________________________________________________________________________

Rubi [A]  time = 0.0122532, antiderivative size = 41, normalized size of antiderivative = 1., number of steps used = 2, number of rules used = 2, integrand size = 16, $$\frac{\text{number of rules}}{\text{integrand size}}$$ = 0.125, Rules used = {713, 245} $x (1-x)^p \left (x^2+x+1\right )^p \left (1-x^3\right )^{-p} \, _2F_1\left (\frac{1}{3},-p;\frac{4}{3};x^3\right )$

Antiderivative was successfully veriﬁed.

[In]

Int[(1 - x)^p*(1 + x + x^2)^p,x]

[Out]

((1 - x)^p*x*(1 + x + x^2)^p*Hypergeometric2F1[1/3, -p, 4/3, x^3])/(1 - x^3)^p

Rule 713

Int[((d_.) + (e_.)*(x_))^(m_)*((a_) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> Dist[((d + e*x)^FracPart[p
]*(a + b*x + c*x^2)^FracPart[p])/(a*d + c*e*x^3)^FracPart[p], Int[(d + e*x)^(m - p)*(a*d + c*e*x^3)^p, x], x]
/; FreeQ[{a, b, c, d, e, m, p}, x] && EqQ[b*d + a*e, 0] && EqQ[c*d + b*e, 0] && IGtQ[m - p + 1, 0] &&  !Intege
rQ[p]

Rule 245

Int[((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[a^p*x*Hypergeometric2F1[-p, 1/n, 1/n + 1, -((b*x^n)/a)],
x] /; FreeQ[{a, b, n, p}, x] &&  !IGtQ[p, 0] &&  !IntegerQ[1/n] &&  !ILtQ[Simplify[1/n + p], 0] && (IntegerQ[p
] || GtQ[a, 0])

Rubi steps

\begin{align*} \int (1-x)^p \left (1+x+x^2\right )^p \, dx &=\left ((1-x)^p \left (1+x+x^2\right )^p \left (1-x^3\right )^{-p}\right ) \int \left (1-x^3\right )^p \, dx\\ &=(1-x)^p x \left (1+x+x^2\right )^p \left (1-x^3\right )^{-p} \, _2F_1\left (\frac{1}{3},-p;\frac{4}{3};x^3\right )\\ \end{align*}

Mathematica [C]  time = 0.120741, size = 133, normalized size = 3.24 $\frac{(x-1) (1-x)^p \left (\frac{-2 i x+\sqrt{3}-i}{\sqrt{3}-3 i}\right )^{-p} \left (\frac{2 i x+\sqrt{3}+i}{\sqrt{3}+3 i}\right )^{-p} \left (x^2+x+1\right )^p F_1\left (p+1;-p,-p;p+2;\frac{2 i (x-1)}{-3 i+\sqrt{3}},-\frac{2 i (x-1)}{3 i+\sqrt{3}}\right )}{p+1}$

Warning: Unable to verify antiderivative.

[In]

Integrate[(1 - x)^p*(1 + x + x^2)^p,x]

[Out]

((1 - x)^p*(-1 + x)*(1 + x + x^2)^p*AppellF1[1 + p, -p, -p, 2 + p, ((2*I)*(-1 + x))/(-3*I + Sqrt[3]), ((-2*I)*
(-1 + x))/(3*I + Sqrt[3])])/((1 + p)*((-I + Sqrt[3] - (2*I)*x)/(-3*I + Sqrt[3]))^p*((I + Sqrt[3] + (2*I)*x)/(3
*I + Sqrt[3]))^p)

________________________________________________________________________________________

Maple [F]  time = 1.783, size = 0, normalized size = 0. \begin{align*} \int \left ( 1-x \right ) ^{p} \left ({x}^{2}+x+1 \right ) ^{p}\, dx \end{align*}

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

[In]

int((1-x)^p*(x^2+x+1)^p,x)

[Out]

int((1-x)^p*(x^2+x+1)^p,x)

________________________________________________________________________________________

Maxima [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int{\left (x^{2} + x + 1\right )}^{p}{\left (-x + 1\right )}^{p}\,{d x} \end{align*}

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

[In]

integrate((1-x)^p*(x^2+x+1)^p,x, algorithm="maxima")

[Out]

integrate((x^2 + x + 1)^p*(-x + 1)^p, x)

________________________________________________________________________________________

Fricas [F]  time = 0., size = 0, normalized size = 0. \begin{align*}{\rm integral}\left ({\left (x^{2} + x + 1\right )}^{p}{\left (-x + 1\right )}^{p}, x\right ) \end{align*}

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

[In]

integrate((1-x)^p*(x^2+x+1)^p,x, algorithm="fricas")

[Out]

integral((x^2 + x + 1)^p*(-x + 1)^p, x)

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \left (1 - x\right )^{p} \left (x^{2} + x + 1\right )^{p}\, dx \end{align*}

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

[In]

integrate((1-x)**p*(x**2+x+1)**p,x)

[Out]

Integral((1 - x)**p*(x**2 + x + 1)**p, x)

________________________________________________________________________________________

Giac [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int{\left (x^{2} + x + 1\right )}^{p}{\left (-x + 1\right )}^{p}\,{d x} \end{align*}

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

[In]

integrate((1-x)^p*(x^2+x+1)^p,x, algorithm="giac")

[Out]

integrate((x^2 + x + 1)^p*(-x + 1)^p, x)