I try to sort a list in this way I have a polynomial

DeleteCases[Table[Cos[(2 π)/3 k] z^k, {k, 0, 8}], 0, {-1}]


  {1, -(z/2), -(z^2/2), z^3, -(z^4/2), -(z^5/2), z^6, -(z^7/2), -(z^8/2)}

and will like to sort in alternative array as

{1, -(z/2), z^3, -(z^2/2), z^6, -(z^4/2), -(z^5/2), -(z^7/2), -(z^8/2)} 

and finally eliminate the positive elements of the array

{1, -(z/2), z^3, -(z^2/2), z^6}

and it is possible do it beginning with the polynomial then use CoefficientList but doing this eliminate the z^k in the array enter image description here

it will be someting like this

    1 - z/2 - z^2/2 + z^3 - z^4/2 - z^5/2 + z^6 - z^7/2 - z^8/
  2 -> {1, -(z/2), -(z^2/2), z^3, -(z^4/2), -(z^5/2), 
   z^6, -(z^7/2), -(z^8/2)} -> {1, -(z^2/2), -(z/2), z^3, -(z^4/2), 
    z^6, -(z^5/2), -(z^7/2), -(z^8/2)} -> {1, -(z^2/2), -(z/2), 
    z^3, -(z^4/2), z^6}

and the last array have to elimante the negative term to have a alternative serie. Thanks anyway as you may have noticed I'm a novice in mathematica

  • 1
    $\begingroup$ You say finally eleminate the positives elements of the array but in the quoted result you give $z^3$ and $z^6$ seem to be positive to me. Can you clarify? $\endgroup$
    – bmf
    May 13 at 17:57
  • $\begingroup$ @bmf I had try to clarify with an example what I try to do, thanks anyway $\endgroup$ May 13 at 20:43
  • 1
    $\begingroup$ Is 1 not a positive element? What is n1 on the summation? Could you please describe your sort algorithm in words? The question is unclear as presented and the desired result is ambiguous. $\endgroup$
    – Syed
    May 14 at 3:58
  • $\begingroup$ @Syed what I want is to get an infinite alternative series of terms, rearranging the terms so that they are positive negative and eliminating the tail of terms that will be mostly negative, n1 is a positive integer $\endgroup$ May 14 at 7:41
  • 1
    $\begingroup$ Why does the z^2 come before the z term in the final list? Why isn't there a term with a positive coefficient interposed between them? $\endgroup$
    – Michael E2
    May 14 at 14:06


Browse other questions tagged or ask your own question.