[Tutor] inserting items into a list
Sheila King
sheila@thinkspot.net
Thu, 03 May 2001 22:48:41 -0700
On Thu, 03 May 2001 16:27:00 -0700, Sheila King <sheila@thinkspot.net> wrote
about Re: [Tutor] inserting items into a list:
:SK> I would note, that since you are multiplying a 3rd degree polynomial by a
:SK> 2nd degree one, that your result should be fifth degree. You could find
:SK> this out by doing len(p1)-1 added to len(p2)-1 then create a new
:SK> list to store the results of your multiplication. Give it length of
:SK> 5 and initialize all spots to zero. Let's call this new list for the
:SK> result, p3.
Er... there's an error in what I suggest above. (Maybe you caught it already?)
Multiplying a 3rd degree poly by a 2nd degree poly does indeed give a 5th
degree poly.
HOWEVER, for the resulting 5th deg poly, you need to create a list of length
6, NOT length 5.
Doh!
--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/