 about the proot command output - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: about the proot command output (/thread-2237.html) about the proot command output - Alberto Candel - 10-05-2014 09:39 PM Hi, The proot command in the Prime inputs a list, say p, and outputs a list, proot(p), whose items are the roots of the polynomial whose coefficients are those of the list p, with 1st item in list equal to constant coefficient, and so on. Is there any rule as to how the roots are ordered in the list proot(p)? Sometimes I get real numbers first, sometime complex numbers first. For example, proot([1 -2 -4 4 -5 6])=[3. 1. -2. -i i]) proot([1 -2 -4 4 -5 7])=[-2.74e-2+1.03*i -2.74e-2-1.03*i 1.07 -2.01 2.98] Also, related to input, how does the CAS Setting INCREASING affect the order of the input list of coefficients? Thanks RE: about the proot command output - parisse - 10-06-2014 08:17 AM proot output is not sorted, run sort(proot(...)) to sort it. Increasing coeffs flag is for symbolic output only. 1-d polynomial input/output as a list of coefficients is sorted from x^n to x^0. RE: about the proot command output - Alberto Candel - 10-06-2014 02:18 PM (10-06-2014 08:17 AM)parisse Wrote:  proot output is not sorted, run sort(proot(...)) to sort it. Increasing coeffs flag is for symbolic output only. 1-d polynomial input/output as a list of coefficients is sorted from x^n to x^0. Thank you. But how does SORT work on a list that has both real and complex numbers? It does sort the real numbers from small to large, but I cannot figure out what it does to the complex ones: SORT([1 i -i 3 2+i])=[1 3 2+i i -i] Or what it does to lists with just complex numbers SORT([-2+i -i 2+i 3-i 5i]) = [5i 3-i 2i -2i -i] RE: about the proot command output - parisse - 10-06-2014 03:58 PM If you want to sort by real part first then imaginary part, you can try something like: l:=[-2+i, -i, 2+i ,3-i ,5i]; sort(l,(a,b)->if re(a)!=re(b) then re(a)if re(a)!=re(b) then re(a)