01:198:323 Lecture Notes - Lecture 3: Glossary Of Video Game Terms, Methamphetamine
Document Summary
Consider having a polynomial p(x) = a0 + a1x + a2x2 + + anxn which you need to evaluate for many values of x. This may seem a strange question, but the answer is not as obvious as you might think. The standard way, written in a loose algorithmic for- mat: poly = a0 f or j = 1 : n poly = poly + ajxj end. To compare the costs of di erent numerical meth- ods, we do an operations count, and then we compare these for the competing methods. Above, the counts are as follows: additions : n multiplications : 1 + 2 + 3 + + n = This assumes each term ajxj is computed indepen- dently of the remaining terms in the polynomial. Next, do the terms xj recursively: xj = x xj 1. Then to computenx2, x3, , xno will cost n 1 mul- tiplications.