(Fwd) Re: [Tutor] multiplication of polynomials in Python
KIU Shueng Chuan
xinch@free.fr
Thu, 3 May 2001 23:12:56 +0200
(I sent this previously with the wrong email addx, apologies if two
copies get sent)
On 3 May 2001, at 2:59, Julieta Rangel wrote:
> I got the integration and differentiation programs to work. Right now I'm
> working on multiplication of polynomials. This is what I have so far:
How about doing addition first?
an example:
(ax^2 + bx + c) * ( dx^2 + ex + f)
= ax^2 * (dx^2 + ex + f) + bx * (dx^2 + ex + f) + c * (dx^2 + ex + f)
Take the first polynomial, split into its separate components and
multiply each component into the second polynomial. Then at the
end add them up.
using your representation:
ax^2 * (dx^2 + ex + f) would be the multiplication between
[0,0,a]
and
[f,e,d]
which equals
[0,0,a*f, a*e, a*d]