请输入您要查询的字词:

 

单词 ComputingPowersByRepeatedSquaring
释义

computing powers by repeated squaring


From time to time, there arise occasions where one wants to raise anumber to a large integer power. While one can compute xn bymultiplying x by itself n times, not only does this entail alarge expenditure of effort when n is large, but roundoff errorscan accumulate. A more efficient approach is to first rise x topowers of two by successive squaring, then multiply to obtain xn.This procedure will now be explained by computing 1.08145187.

The first step is to express n as a sum of powers of two, i.e. inbase 2. In our example, we have 187=1+2+8+16+32+128.

By the basic properties of exponentiation, we therefore havex187=xx2x8x16x32x128.

The next step is to raise 1.08145 to powers of two, which we accomplishby repeatedly squaring like so: (In order to guard against roundofferror, we work with more decimal places than needed and round off at theend of the computation.)

x=1.08145
x2=1.1695341
x4=(x2)2=1.16953412=1.3678100
x8=(x4)2=1.36781002=1.8709042
x16=(x8)2=1.87090422=3.5002825
x32=(x16)2=3.50028252=12.251978
x64=(x32)2=12.2519782=150.110965
x128=(x64)2=150.1109652=26523642.95

Finally, we multiply together the appropriate powers to obtain ouranswer:

1.081451.16953411.87090423.500282512.25197826523642.95=2691617615

Hence, we compute 1.08145187=2.69162×109.

Note that this computation involved only 12 multiplicationsas opposed to 186 multiplications. More generally, we willrequire log2n repeated squarings and up to log2nmultiplications of the repeated squares, or a total of betweenlog2n and 2log2n multiplications to computexn this way.

More generally, the same method can be used to compute xnwhen x is a complex number or a matrix, or something evenmore general, such as an element of a group. Thus thisapproach can be adapted to computing exponentialsMathworldPlanetmathPlanetmath andtrigonometric functionsDlmfMathworld, numerical approximation of differentialequationMathworldPlanetmath, and the like.

随便看

 

数学辞典收录了18232条数学词条,基本涵盖了常用数学知识及数学英语单词词组的翻译及用法,是数学学习的有利工具。

 

Copyright © 2000-2023 Newdu.com.com All Rights Reserved
更新时间:2025/5/4 1:42:31