Polynomial synthetic division: Difference between revisions
Content added Content deleted
(→{{header|Python}}: Clarified description) |
m (→{{header|Python}}: Fix spelling) |
||
Line 74: | Line 74: | ||
coef = out[i] |
coef = out[i] |
||
if coef != 0: # useless to multiply if coef is 0 |
if coef != 0: # useless to multiply if coef is 0 |
||
for j in xrange(1, len(divisor)): # in synthetic division, we always skip the first coefficient of the |
for j in xrange(1, len(divisor)): # in synthetic division, we always skip the first coefficient of the divisor, |
||
# because it's only used to normalize the dividend coefficients |
# because it's only used to normalize the dividend coefficients |
||
out[i + j] += -divisor[j] * coef |
out[i + j] += -divisor[j] * coef |