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 grade-anxiety reactions. How sad that this has to be an issue. 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
_______________________________________________ Edu-sig mailing list Edu-sig@python.org http://mail.python.org/mailman/listinfo/edu-sig