Exercise 2

  1. Complete the 8-bit, unsigned addition given below. Show all the steps in both hexadecimal (left) and binary (right).

    \[\begin{aligned} &\textsf{hex} \quad & &\textsf{binary}\\ &\texttt{AF} & &\square\square\square\square\square\square\square\square\\ +&\texttt{72} &+&\square\square\square\square\square\square\square\square\\ \hline &\!\!\square\square &&\square\square\square\square\square\square\square\square \end{aligned}\]

    Is there an overflow?

  2. Suppose we want to find an iterative algorithm for raising the number \(\mathsf{a}\) to a rational power—i.e., for computing \(\mathsf{a^{p/q}}\) with \(\mathsf{p}\) and \(\mathsf{q}\) integer. Convince yourself that the sequence defined by

    \[\begin{aligned} \mathsf{x_0} & := \mathsf{1}\\ \mathsf{x_{n+1}} & := \mathsf{\Bigl(1-\frac{1}{q}\Bigr)x_n} + \mathsf{\frac{a^p}{q}x_n^{1-q}} \end{aligned}\]

    has \(\mathsf{a^{p/q}}\) as its limit. I suggest you proceed in this way: suppose that \(\mathsf{x_n}\) is a good guess to the answer; construct a better guess \(\mathsf{x_{n+1}} = \mathsf{x_n} + \mathsf{\delta x} \approx \mathsf{a^{p/q}}\); solve for \(\mathsf{\delta x}\) to lowest order in a series expansion.

  3. Find the value of \(\mathsf{b}\) such that the functions

    \[\begin{aligned} \mathsf{t(x)} &= \mathsf{x} - \mathsf{\frac{1}{3}x^3} + \mathsf{\frac{2}{15}x^5}\\ \textsf{and} \ \ \mathsf{r(x)} & = \mathsf{\frac{15x+x^3}{15+b x^2}} \end{aligned}\]

agree to sixth order. Plot the functions \(\mathsf{t(x)}\), \(\mathsf{r(x)}\), and \(\mathsf{tanh}\,\mathsf{x}\) in the range \(\mathsf{0} \le \mathsf{x} \le \mathsf{2}\). Also, plot the differences \(\mathsf{t(x)}-\textsf{tanh}\,\mathsf{x}\) and \(\mathsf{r(x)} - \textsf{tanh}\,\mathsf{x}\) with the log scale on the y-axis. How do they compare? What do \(\mathsf{t(x)}\) and \(\mathsf{r(x)}\) represent?