请输入您要查询的字词:

 

单词 ExampleOfStraightlineProgram
释义

example of straight-line program


SLPs can be used to shorten computations of algebraic expressions.

For example: The product 519 may be evaluated in fewer than 19 multiplication.

Let f0(x)=x and fi+1(x)=fi(x)fi(x), for i.Evidently

fi(x)=x2i,i.

However, we do not evaluate fi(5) as 5i. For instance, to compute f3(5)=58 wefollow the program. Expand the first the expression from the left first until wereach an f0(x) term:

f3(5)=f2(5)f2(5)
=(f1(5)f1(5))f2(5)
=((f0(5)f0(5))f1(5))f2(5).

Now evaluate the terminal parts and store all the intermediate results:

f0(5)=5,
f1(5)=f0(5)f0(5)=55=25,
f2(5)=f1(5)f1(5)=2525=625, and
f3(5)=625625=390625.

The total number of multiplications here was 3, rather than 8.

Then x19 can be encoded as an SLP using the binary number for 19.

First, write 19 in binary (base 2):

19=124+023+022+121+120,

or rather 10011 in the usual binary notation.

(x)=f4(x)1f3(x)0f2(x)0f1(x)1f0(x)1=f4(x)f1(x)f0(x).

Remark. To evaluate this SLP we had to store intermediate values thatwere ultimately not part of the final answer. In this example the final answerwas much larger than the intermediate steps and so we are free to assume thatany memory used in the process was far less than what was required for the finaloutcome. However, it is entirely possible that evaluating an SLP will at timesuse far more memory than required by the final product and may therefore beinfeasible.

随便看

 

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

 

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