On Friday we were studying synthetic substitution/division in Algebra 2. <br>After going through the algorithm and after showing through factoring why it worked, I had them look at this code:<br><br>def evaluate(polynomial, x):<br>
value = 0<br>
for coefficient in polynomial:<br> value = value*x + coefficient<br> return value<br><br><i>polynomial </i>is a list of coefficients.<br><br>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.<br>
<br>This 'concept map' shows exactly the same thing as the diagram in our text, but it would be even more accurate to initialize <i>value</i> 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.<br>
<br>But I figure that for the kids that are interested, and there are some, looking at indexing and splicing might be enticing.<br><br>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.<br><br>- Michel<br>