top | item 17904870

(no title)

jonalmeida | 7 years ago

I think there's an error in the first example.

  Poly [1, -3, 0, 1]
Should be:

  Poly [1, 0, -3, 1]
EDIT: My mistake.

discuss

order

sqrt17|7 years ago

It's not - it starts with the unit coefficient (1), then x (-3), then x^2 (0), then x^3 (1). Some things become easier this way - including addition of polynomials of differing degree - and as an added bonus you can phantasize about representing power series as (lazy) infinite lists.

laurentl|7 years ago

I thought so too at first but given the way addition is defined later on, it makes sense to keep the coefficients sorted by increasing power (the leftmost element in the list is its head, and the easiest to access when doing anything recursive)