PolynomialTools/RootPowerSum - Maple Help

PolynomialTools

 RootPowerSum
 compute the sum of a give power of the roots of a polynomial

 Calling Sequence RootPowerSum( p, x, n )

Parameters

 p - : polynom : a polynomial in x x - : name : the indeterminate n - : nonnegint : the power of the roots of p

Description

 • The RootPowerSum( p, x, n ) command computes the sum of the $n$-th powers of the roots of the polynomial p in the indeterminate x.
 • Note that RootPowerSum( p, x, 0 ) is the same as the degree of p in x; RootPowerSum( p, x, 1 ) is the sum of the roots of p (as a polynomial in x); RootPowerSum( p, x, 2 ) is the sum of the squares of the roots of p; and so on.

Examples

 > $\mathrm{with}\left(\mathrm{PolynomialTools}\right):$
 > $p≔{x}^{3}-2{x}^{2}-5x+3$
 ${p}{≔}{{x}}^{{3}}{-}{2}{}{{x}}^{{2}}{-}{5}{}{x}{+}{3}$ (1)
 > $\mathrm{RootPowerSum}\left(p,x,0\right)$
 ${3}$ (2)
 > $\mathrm{RootPowerSum}\left(p,x,1\right)$
 ${2}$ (3)
 > $\mathrm{RootPowerSum}\left(p,x,2\right)$
 ${14}$ (4)
 > $p≔\mathrm{expand}\left(\left(x-2\right){\left(x-1\right)}^{2}\right)$
 ${p}{≔}{{x}}^{{3}}{-}{4}{}{{x}}^{{2}}{+}{5}{}{x}{-}{2}$ (5)
 > $\mathrm{RootPowerSum}\left(p,x,0\right)$
 ${3}$ (6)
 > $\mathrm{RootPowerSum}\left(p,x,1\right)$
 ${4}$ (7)
 > $\mathrm{RootPowerSum}\left(p,x,2\right)$
 ${6}$ (8)
 > $\mathrm{RootPowerSum}\left(p,x,3\right)$
 ${10}$ (9)
 > $\mathrm{RootPowerSum}\left(p,x,4\right)$
 ${18}$ (10)
 > $p≔{x}^{4}y-{y}^{2}x+xy-4$
 ${p}{≔}{{x}}^{{4}}{}{y}{-}{{y}}^{{2}}{}{x}{+}{x}{}{y}{-}{4}$ (11)
 > $\mathrm{RootPowerSum}\left(p,x,0\right)$
 ${4}$ (12)
 > $\mathrm{RootPowerSum}\left(p,y,0\right)$
 ${2}$ (13)
 > $\mathrm{RootPowerSum}\left(p,x,3\right)$
 ${3}{}{y}{-}{3}$ (14)
 > $\mathrm{RootPowerSum}\left(p,y,2\right)$
 $\frac{{{x}}^{{7}}{+}{2}{}{{x}}^{{4}}{+}{x}{-}{8}}{{x}}$ (15)

A generic cubic polynomial expressed as a product of linear factors.

 > $p≔\mathrm{expand}\left(\left(x-r\right)\left(x-s\right)\left(x-t\right)\right)$
 ${p}{≔}{-}{r}{}{s}{}{t}{+}{r}{}{s}{}{x}{+}{r}{}{t}{}{x}{-}{r}{}{{x}}^{{2}}{+}{s}{}{t}{}{x}{-}{s}{}{{x}}^{{2}}{-}{t}{}{{x}}^{{2}}{+}{{x}}^{{3}}$ (16)
 > $\mathrm{RootPowerSum}\left(p,x,1\right)$
 ${r}{+}{s}{+}{t}$ (17)
 > $\mathrm{RootPowerSum}\left(p,x,2\right)$
 ${{r}}^{{2}}{+}{{s}}^{{2}}{+}{{t}}^{{2}}$ (18)
 > $\mathrm{RootPowerSum}\left(p,x,30\right)$
 ${{r}}^{{30}}{+}{{s}}^{{30}}{+}{{t}}^{{30}}$ (19)

Consider a general quadratic polynomial in x.

 > $p≔a{x}^{2}+bx+c$
 ${p}{≔}{a}{}{{x}}^{{2}}{+}{b}{}{x}{+}{c}$ (20)
 > $d≔\mathrm{discrim}\left(p,x\right)$
 ${d}{≔}{-}{4}{}{a}{}{c}{+}{{b}}^{{2}}$ (21)

The quadratic formula gives us the following roots for p.

 > $u≔\frac{-b+\mathrm{sqrt}\left(d\right)}{2a}$
 ${u}{≔}\frac{{-}{b}{+}\sqrt{{-}{4}{}{a}{}{c}{+}{{b}}^{{2}}}}{{2}{}{a}}$ (22)
 > $v≔\frac{-b-\mathrm{sqrt}\left(d\right)}{2a}$
 ${v}{≔}\frac{{-}{b}{-}\sqrt{{-}{4}{}{a}{}{c}{+}{{b}}^{{2}}}}{{2}{}{a}}$ (23)
 > $\mathrm{RootPowerSum}\left(p,x,1\right)=\mathrm{normal}\left(u+v\right)$
 ${-}\frac{{b}}{{a}}{=}{-}\frac{{b}}{{a}}$ (24)
 > $\mathrm{RootPowerSum}\left(p,x,2\right)=\mathrm{normal}\left({u}^{2}+{v}^{2}\right)$
 ${-}\frac{{2}{}{a}{}{c}{-}{{b}}^{{2}}}{{{a}}^{{2}}}{=}{-}\frac{{2}{}{a}{}{c}{-}{{b}}^{{2}}}{{{a}}^{{2}}}$ (25)
 > $\mathrm{RootPowerSum}\left(p,x,3\right)=\mathrm{normal}\left({u}^{3}+{v}^{3}\right)$
 $\frac{{b}{}\left({3}{}{a}{}{c}{-}{{b}}^{{2}}\right)}{{{a}}^{{3}}}{=}\frac{{b}{}\left({3}{}{a}{}{c}{-}{{b}}^{{2}}\right)}{{{a}}^{{3}}}$ (26)

As a polynomial in $x$, this polynomial has roots $y$, $2z$ and $yz$.

 > $p≔\mathrm{expand}\left(\left(x-y\right)\left(x-2z\right)\left(x-yz\right)\right)$
 ${p}{≔}{-}{{x}}^{{2}}{}{y}{}{z}{+}{x}{}{{y}}^{{2}}{}{z}{+}{2}{}{x}{}{y}{}{{z}}^{{2}}{-}{2}{}{{y}}^{{2}}{}{{z}}^{{2}}{+}{{x}}^{{3}}{-}{{x}}^{{2}}{}{y}{-}{2}{}{{x}}^{{2}}{}{z}{+}{2}{}{x}{}{y}{}{z}$ (27)
 > $\mathrm{RootPowerSum}\left(p,x,0\right)$
 ${3}$ (28)
 > $\mathrm{RootPowerSum}\left(p,x,1\right)$
 ${y}{}{z}{+}{y}{+}{2}{}{z}$ (29)
 > $\mathrm{RootPowerSum}\left(p,x,2\right)$
 ${{y}}^{{2}}{}{{z}}^{{2}}{+}{{y}}^{{2}}{+}{4}{}{{z}}^{{2}}$ (30)
 > $\mathrm{RootPowerSum}\left(\mathrm{mul}\left(x-r‖i,i=1..12\right),x,10\right)$
 ${{\mathrm{r1}}}^{{10}}{+}{{\mathrm{r10}}}^{{10}}{+}{{\mathrm{r11}}}^{{10}}{+}{{\mathrm{r12}}}^{{10}}{+}{{\mathrm{r2}}}^{{10}}{+}{{\mathrm{r3}}}^{{10}}{+}{{\mathrm{r4}}}^{{10}}{+}{{\mathrm{r5}}}^{{10}}{+}{{\mathrm{r6}}}^{{10}}{+}{{\mathrm{r7}}}^{{10}}{+}{{\mathrm{r8}}}^{{10}}{+}{{\mathrm{r9}}}^{{10}}$ (31)
 > $p≔\mathrm{expand}\left(\left(x-\mathrm{sqrt}\left(2\right)\right)\left(x-\mathrm{sqrt}\left(3\right)\right)\left(x-\mathrm{sqrt}\left(7\right)\right)\right)$
 ${p}{≔}{{x}}^{{3}}{-}{{x}}^{{2}}{}\sqrt{{7}}{-}{{x}}^{{2}}{}\sqrt{{3}}{+}{x}{}\sqrt{{3}}{}\sqrt{{7}}{-}\sqrt{{2}}{}{{x}}^{{2}}{+}\sqrt{{2}}{}{x}{}\sqrt{{7}}{+}\sqrt{{2}}{}\sqrt{{3}}{}{x}{-}\sqrt{{2}}{}\sqrt{{3}}{}\sqrt{{7}}$ (32)
 > $\mathrm{RootPowerSum}\left(p,x,1\right)$
 $\sqrt{{7}}{+}\sqrt{{3}}{+}\sqrt{{2}}$ (33)
 > $\mathrm{RootPowerSum}\left(p,x,2\right)$
 ${12}$ (34)
 > $\mathrm{RootPowerSum}\left(p,x,20\right)$
 ${282535322}$ (35)
 > $p≔\mathrm{expand}\left(\left(x-\mathrm{sqrt}\left(2\right)\right)\left(x-\mathrm{sin}\left(1\right)\right)\left(x-\mathrm{exp}\left(t\right)\right)\right)$
 ${p}{≔}{{x}}^{{3}}{-}{{x}}^{{2}}{}{{ⅇ}}^{{t}}{-}{{x}}^{{2}}{}{\mathrm{sin}}{}\left({1}\right){+}{x}{}{\mathrm{sin}}{}\left({1}\right){}{{ⅇ}}^{{t}}{-}\sqrt{{2}}{}{{x}}^{{2}}{+}\sqrt{{2}}{}{x}{}{{ⅇ}}^{{t}}{+}\sqrt{{2}}{}{\mathrm{sin}}{}\left({1}\right){}{x}{-}\sqrt{{2}}{}{\mathrm{sin}}{}\left({1}\right){}{{ⅇ}}^{{t}}$ (36)
 > $\mathrm{RootPowerSum}\left(p,x,1\right)$
 ${{ⅇ}}^{{t}}{+}{\mathrm{sin}}{}\left({1}\right){+}\sqrt{{2}}$ (37)
 > $\mathrm{RootPowerSum}\left(p,x,4\right)$
 ${\left({{ⅇ}}^{{t}}\right)}^{{4}}{+}{{\mathrm{sin}}{}\left({1}\right)}^{{4}}{+}{4}$ (38)

Compatibility

 • The PolynomialTools[RootPowerSum] command was introduced in Maple 2022.