This problem considers ways to compute n, where is a positive integer. This problem arose from trying to explain MATLAB’s rather large flop time in Table 1.3 for integer powers. (a) Compare the total...


This problem considers ways to compute


n
, where

is a positive integer. This problem arose from trying to explain MATLAB’s rather large flop time in Table 1.3 for integer powers.


(a) Compare the total number of flops between computing


n

=
∗ ∗, and computing





where

=

2. As examples of the last formula,

6
=




, while

5
=



.


(b) Suppose n = 28. Show that 28 = 24
+ 23
+ 22, and





What is the minimum number of flops required using this formula? Also explain why 24
+ 23
+ 22
is the floating-point representation of 28. Note that this procedure is a version of the square-and-multiply algorithm.


(c) Suppose

= 100, so its floating-point representation is (1 +

+
)×26. Explain how to use the idea in part (b) to calculate

100. How does the flop count compare with the two methods in part (a)?


(d) Another approach, assuming

is positive, is to write

n

=


n ln x
. Based on the values in Table 1.3, what is the approximate flop time for this? How does it compare with the flop times found in parts (b) and (c)?

Dec 19, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here