2012-08-28

Stalled Again!

Okay, so it's been two months since my last post. Worse still, in my last post I was in the middle of reworking exercise 2.92. Sorry to keep you hanging...
I'm sure you'll be pleased to hear that, no, I've not abandoned this. I've just been really busy, particularly at work, which means I've not had a chance to do much work on finishing this off. I'll give you a progress report though.
First thing to note is that the "This is not easy!" from the exercise description is quite right, which is why I've not managed to finish it yet. It requires little a bit more than five minutes grabbed here and there. So I imagine there'll still be a bit more of a delay before I finally post my solution.
I have made some progress however:
  1. I've defined an ordering on variables (alphanumeric rocks!) which implies a particular canonical form for polynomials.
  2. Using this I've produced a procedure which takes a polynomial and expands all of the terms of it (into a simplified form, not the tagged form we've been using). E.g. it'll take the polynomial (x2 + 5x - 3)y2 + (2x2 + 3x + 1)y - 5
  3. and expand this to (y2)x2 + (5y2)x - 3y2 + (2y)x2 + (3y)x + y - 5
  4. I have a further procedure which can take the expansion and rearrange the terms so that they are sorted by decreasing order of terms and sub-terms. I.e. it would take the results of the previous expansion and rearrange it as: (y2)x2 + (2y)x2 + (5y2)x + (3y)x - 3y2 + y - 5
The next stage of the process will be to collapse the rearranged polynomial. To do this I'll need to determine what the canonical top-level indeterminate is for the rearranged form (which is simply the outer-most indeterminate for the first expanded term). Having done that I'll need to pass through the top-level, gather together all expanded terms which have the same order for the outer-most indeterminate, recurse on those to produce a coefficient for that order and create the corresponding term, gathering the resulting terms together into the final polynomial. So not much then...
...and hopefully done quicker than a couple of months...

No comments:

Post a Comment