Week 4 Eigenvectors python lab programming

I have foll questions with respect to week 4 programming lab:

  1. What does utils.plot_transformation do? I was not able to find any info a few python docs I tried out.

  2. What is the point of Example 4 and 5? what are we trying to do with scaling and with projecting? Did not understand the meaning of the output or what the point of process was.

Would be grateful if anyone can explain the above.

Well, I agree that the code is pretty complicated and you’d really have to step through and understand each line. But what it is doing in terms of the generated output is pretty clear, don’t you think? It takes a transformation matrix and two basis vectors as input, then it shows you the “before and after” of the original basis vectors and then what they look like after the transformation is applied. If you want to understand all the details, you’ll need to parse each line and spend some time with the numpy and matplotlib documentation.

They explain it all in the text. In Example 4, they walk you through how the numpy np.linalg.eig function handles the eigenvectors for the identity matrix and then a transformation that scales everything by 2. As they explain in the text, from a pure mathematical definition, there are an infinite number of eigenvectors for those transformations (every vector is an eigenvector). But the way the numpy function works is that it just returns you two standard basis vectors (1, 0) and (0, 1) as the eigenvectors in both cases.

Example 5 is the “degenerate” case in which one of the eigenvalues is zero and it shows you how the library handles that.

I didn’t fabricate any of the things I said above: it’s all in the text in the notebook.