Multiplication algorithm: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 1:
HI IM T.J. SCHOLBHNERG! A '''multiplication algorithm''' is an [[algorithm]] (or method) to [[multiplication|multiply]] two numbers. Depending on the size of the numbers, different algorithms are in use.
lslslslasaldkifhgjaldkjghasdflkjghadflkjbvnadlk bvdfaa hi im t.j entries. Rather than first computing the products, and then adding them all together in a second phase, computers add the products to the result as soon as they are computed. Modern chips 64-[[bit]] numbers in [[hardware]] or in [[microcodewith ''m''-digit numbers ''x''<sub>1</sub>, ''x''<sub>2</sub>, ''y''<sub>1</sub> and ''y''<sub>2</sub>. The product is given by
 
A major advantage of [[numeral system|positional numeral system]]s over other systems of writing down numbers is that they facilitate the usual grade-school method of '''long multiplication''': multiply the first number with every digit of the second number and then add up all the properly shifted results. In order to perform this algorithm, one needs to know the products of all possible digits, which is why [[multiplication table]]s have to be memorized. Humans use this algorithm in base 10, while computers employ the same algorithm in base 2. The algorithm is a lot simpler in base 2, since the multiplication table has only 4 entries. Rather than first computing the products, and then adding them all together in a second phase, computers add the products to the result as soon as they are computed. Modern chips 64-[[bit]] numbers in [[hardware]] or in [[microcodewith ''m''-digit numbers ''x''<sub>1</sub>, ''x''<sub>2</sub>, ''y''<sub>1</sub> and ''y''<sub>2</sub>. The product is given by
: ''xy'' = ''x''<sub>1</sub>''y''<sub>1</sub> 10<sup>2''m''</sup> + (''x''<sub>1</sub>''y''<sub>2</sub> + ''x''<sub>2</sub>''y''<sub>1</sub>) 10<sup>''m''</sup> + ''x''<sub>2</sub>''y''<sub>2</sub>
so we need to quickly determine the numbers ''x''<sub>1</sub>''y''<sub>1</sub>, ''x''<sub>1</sub>''y''<sub>2</sub> + ''x''<sub>2</sub>''y''<sub>1</sub> and ''x''<sub>2</sub>''y''<sub>2</sub>. The heart of Karatsuba's method lies in the observation that this can be done with only three rather than four multiplications: