python指数怎么表示_在Python中如何实现指数化?
The simplest method of computing b? requires n?1 multiplication operations, but it can be computed more efficiently than that, as illustrated by the following example. To compute 21??, note that 100 = 64 + 32 + 4. Compute the following in order:22 = 4
(22)2 = 2? = 16
(2?)2 = 2? = 256
(2?)2 = 21? = 65,536
(21?)2 = 232 = 4,294,967,296
(232)2 = 2?? = 18,446,744,073,709,551,616
2?? × 232 × 2? = 21?? = 1,267,650,600,228,229,401,496,703,205,376This series of steps only requires 8 multiplication operations instead of 99 (since the last product above takes 2 multiplications).
In general, the number of multiplication operations required to compute b? can be reduced to Θ(log n) by using exponentiation by squaring or (more generally) addition-chain exponentiation. Finding the minimal sequence of multiplications (the minimal-length addition chain for the exponent) for b? is a difficult problem for which no efficient algorithms are currently known (see Subset sum problem), but many reasonably efficient heuristic algorithms are available.[29]
平方求冪這一頁很難總結,但它基本上是2?==(2?)2==(22)2,所以不需要計算2 × 2 × 2 × 2 × 2 × 2 × 2 × 2 = 256,而是可以計算2 × 2 = 4; 4 × 4 = 16; 16 × 16 = 256。在
總結
以上是生活随笔為你收集整理的python指数怎么表示_在Python中如何实现指数化?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: js拆字分图程序 _拆分古籍_梦溪笔谈方
- 下一篇: htc+m7+android系统+电源,