Homework 1

This is due on Thurs, 6/1

  1. Consider the polynomial $p(x) = (x-2)^9 = x^9 - 18x^8 + 144x^7 - 672x^6 + 2016x^5 - 4032x^4 + 5376x^3 - 4608x^2 + 2304x - 512$

    a. Plot $p(x)$ for $x=1.920,\,1.921,\,1.922,\ldots,2.080$ evaluating $p$ via its coefficients $1,\,,-18,\,144,\ldots$

    b. Plot the same plot again, now evaluating $p$ via the expression $(x-2)^9$.

    c. Explain the difference.

    (The numpy method linspace will be useful for this)

2. How many different double-precision numbers are there? Express your answer using powers of 2

3. Using the updated Numbers Every Programmer Should Know, how much longer does a main memory reference take than an L1 cache look-up? How much longer does a disk seek take than a main memory reference?

4. From the Halide Video, what are 4 ways to traverse a 2d array?

5. Using the animations below (source), explain what the benefits and pitfalls of each approach. Green squares indicate that a value is being read; red indicates a value is being written. Your answers should be longer in length (give more detail) than just two words.

a. Halide

b. Halide

c. Halide

6. Prove that if $A = Q B Q^T$ for some orthnogonal matrix $Q$, the $A$ and $B$ have the same singular values.

7. What is the stochastic part of stochastic gradient descent?