# [Edu-sig] synthetic division

michel paul mpaul213 at gmail.com
Sun Dec 14 05:26:51 CET 2008

```On Friday we were studying synthetic substitution/division in Algebra 2.
After going through the algorithm and after showing through factoring why it
worked, I had them look at this code:

def evaluate(polynomial, x):
value = 0
for coefficient in polynomial:
value = value*x + coefficient
return value

*polynomial *is a list of coefficients.

This algorithm is identical to the factoring analysis I showed them.  To
then create the function 'divide' is a simple matter of returning a list of
coefficients rather than one final value.

This 'concept map' shows exactly the same thing as the diagram in our text,
but it would be even more accurate to initialize *value* as polynomial[0]
and to then make the for-loop 'for coefficient in polynomial[1:]', but I
thought that in an environment where programming in math classes is still
considered something alien, the indexing might cause some silly

But I figure that for the kids that are interested, and there are some,
looking at indexing and splicing might be enticing.

This has been my experience - looking at math concepts I have long taken for
granted and thinking about how to express them in computational form as
interacting functions/classes has shed new light on my own understanding.  I
can't help think that this would be invaluable for education.

- Michel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/edu-sig/attachments/20081213/75c78c27/attachment.htm>
```