Robert Talbert
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
--- class: mth302 --- # Miniproject 4 **Initial due date: Sunday, March 26 at 11:59pm ET** ## Overview Eigenvalues of a matrix are incredibly useful and important for many applications. (Some of these applications are in Miniprojects 1-3.) But computing eigenvalues of a matrix, even of relatively small size, can be difficult or impossible to do exactly. So we need *numerical approximation methods* for most practical uses of eigenvalues. This miniproject will teach you one such method. **Prerequisites:** You'll need to know what an eigenvalue and eigenvector for a matrix are, and how to find these using SymPy. You'll also need to know how to multiply matrices and vectors. ## Background Complete the following warmup exercises first. These don't go in your writeup. They are just here to teach you some terminology you'll need in the main assignment. >Definition: Suppose $A$ is an $n \times n$ matrix and $\lambda_1, \lambda_2, \dots, \lambda_n$ are its eigenvalues. Then $\lambda_1$ is called the **dominant eigenvalue** of $A$ if $|\lambda_1| > |\lambda_i|$ for all $i \neq 1$. The eigenvectors corresponding to $\lambda_1$ are called **dominant eigenvectors** of $A$. **Example:** The matrix $A = \begin{bmatrix} -2 & 0 \\ 0 & 1 \end{bmatrix}$ has eigenvalues of $-2$ and $1$. Of these, $\lambda = -2$ is the dominant eigenvalue since $|-2| > |1|$. A dominant eigenvector for $A$ would be $[1,0]^T$ since that's an eigenvector corresponding to the dominant eigenvalue $\lambda = -2$. **Example:** The matrix $A = \begin{bmatrix} -1 & 0 \\ 0 & 1 \end{bmatrix}$ doesn't have a dominant eigenvalue, since its two eigenvalues are $-1$ and $1$, and neither $|-1| > |1|$ nor $|1| > |-1|$. **Exercise:** Find the dominant eigenvalue and a dominant eigenvector for $$B = \left[\begin{matrix}11 & 0 & -4\\17 & -2 & -5\\30 & 0 & -11\end{matrix}\right]$$ *Answer:* $\lambda_1 = -2$ is the dominant eigenvalue and $\mathbf{v}_1 = [0,1,0]^T$ is a dominant eigenvector. ## Assignment 1. Suppose $A$ is a $100 \times 100$ matrix. This is actually considered "small" for most real-world applications. If we wanted to find its eigenvalues using the basic method we learned in class, we would need to solve the equation $\det(A - \lambda I_{100}) = 0$ for $\lambda$. How easy or hard would this be? Why? The first problem illustrates the computational issues with using our basic method for finding eigenvalues. So rather than find the eigenvalues of a matrix algebraically, it's often enough to (1) find just the *dominant* eigenvalue, and (2) get a reasonable numerical approximation to it. The rest of this miniproject walks you through one method for doing this. 2. Let $A = \begin{bmatrix} -5 & 14 \\ 9 & 15 \end{bmatrix}$. Choose any nonzero vector in $\mathbb{R}^2$ and call it $\mathbf{x}_0$. Compute $\mathbf{x}_1 = A \mathbf{x}_0$. 3. Compute $\mathbf{x}_2 = A \mathbf{x}_1$. Notice, this is the same as $A \cdot A \cdot \mathbf{x}_0$ or $A^2 \mathbf{x}_0$. 4. Compute $\mathbf{x}_3 = A \mathbf{x}_2$, which is the same as $A^3 \mathbf{x}_0$. 5. The vectors you are computing are getting larger and larger in terms of their components, but how much is their overall *direction* changing? Take each of the vectors you computed ($\mathbf{x}_0, \mathbf{x}_1, \mathbf{x}_2, \mathbf{x}_3$) and find a **unit vector** that points in the same direction. ([Here is a short refresher on how to do this](https://www.youtube.com/watch?v=lHr0VCXmztI); make sure to turn your sound off!) And, see below for some SymPy notes on this. 6. Continue this process: For $i = 4, \dots, 10$, compute $A^i\mathbf{x}_0$ and then find a unit vector that points in the same direction. 7. You should notice that the results of your calculations seem to be stabilizing around a single unit vector. If this isn't apparent, check your work and/or do a few more iterations of this process. What is that unit vector? 8. Multiply the unit vector you found by the original matrix. Use the result to explain why the unit vector you found in the previous step is *approximately* an eigevector for the original matrix. What is the (approximate) eigenvalue associated with this approximate eigenvector? 9. Now use SymPy to find the exact values of the eigenvalues of $A$. Which one is dominant? Which of these eigenvalues did the method above produce? What was the percent error in your approximation? 10. Adapt the method from above to approximate the dominant eigenvalue and eigenvector for $$B = \displaystyle \left[\begin{matrix}9 & -4 & 1 & 1\\0 & -3 & -4 & -3\\10 & -2 & -1 & -4\\-9 & 9 & 0 & -7\end{matrix}\right]$$ Be sure to fully explain your reasoning and show your code. 11. Use SymPy to find the exact value of the eigenvalues. The results will look like an explosion of math notation. So, after getting the exact values, run the following code to get approximations of the exact values: ```python= for eigenvalue in B.eigenvals().keys(): print(N(eigenvalue)) ``` This will print approximate values of the eigenvalues. Which one is dominant? What is the percentage error in your approximation? ## Notes on this Miniproject **You will be really well served to use SymPy as much as possible on this miniproject.** You should be doing no work by hand; and moreover, tapping in to some of SymPy's capabilities will lighten your load considerably. Here are some things you can do with SymPy that are relevant to this Miniproject. - To raise a matrix to a power, use `**` just like we raise numbers or symbols to powers. - Mathematically, to find the length of a vector, we compute $\sqrt{x_1^2 + x_2^2 + \cdots + x_n^2}$ where $x_1, x_2, \dots x_n$ are its components. But a more economical way to do it is to use the *dot product* and compute $\sqrt{\mathbf{v} \cdot \mathbf{v}}$. In SymPy, to find the dot product of the vector `a` with the vector `b`, enter `a.dot(b)`. To take the square root of an number $x$, enter `sqrt(x)`. You can put these functions together with what you already know how to do in SymPy to automate much of the math in question 5. - SymPy works with *exact* values, but sometimes (like now) we need approximations. To convert an exact value to an approximation, wrap it in `N( )`. For example try `N(sqrt(5))`. - Sometimes we want to print off a vector or a matrix *not* in its "pretty" form, but as plain text so it will not take up so much space. To do this in SymPy, just put `print( )` around the thing you want to display. For example, try `print(Matrix(2,2,[1,2,3,4]))`. - The approximation method in this miniproject involves *iteration*, and computer languages are good at this. The `for` loop construction in Python is helpful. Here's an example of a `for` loop that would print off the squares of the numbers 1 through 100: ```python for i in range(1,101): print(i**2) ``` In Python, ranges stop *just before* the upper limit, so `range(1,101)` is 1, 2, 3, ..., 100. ## Submission and Grading ### Formatting and special items for grading Please review the section on Miniprojects in the document [Standards For Student Work in MTH 302](https://github.com/RobertTalbert/linalg-diffeq/blob/main/course-docs/standards-for-student-work.md#standards-for-miniprojects) before attempting to write up your submission. Note that *all* Miniprojects: - **Must be typewritten**. If any portion of the submission has handwritten work or drawings, it will be marked *Incomplete* and returned without further comment. - **Must represent a good-faith effort at a complete, correct, clearly communicated, and professionally presented solution.** Omissions, partial work, work that is poorly organized or sloppily presented, or work that has numerous errors will be marked *Incomplete* and returned without further comment. - **Must include clear verbal explanations of your work when indicated, not just math or code**. You can tell when verbal explanations are required because the problems say something like "Explain your reasoning". Your work here is being evaluated *partially* on whether your math and code are correct; but just as much on whether your reasoning is correct and clearly expressed. Make sure to pay close attention to both. Miniproject 3 **must be done in a Jupyter notebook using SymPy to carry out all mathematical calculations**. [A sample notebook, demonstrating the solution to a Calculus problem, can be found here](https://github.com/RobertTalbert/linalg-diffeq/blob/main/tutorials/Example_of_solution_in_a_notebook.ipynb). Study this first before writing up your work. ### How to submit You will submit your work on Blackboard in the *Miniproject 4* folder under *Assignments > Miniprojects*. But you will *not* upload a PDF for Miniprojects. Instead you will **share a link that allows me (Talbert) to comment on your work**. [As explained in one of the Jupyter and Colab tutorials](https://gvsu.hosted.panopto.com/Panopto/Pages/Viewer.aspx?id=ef5c0e24-5c1d-437f-be05-af730108b6d8), the process goes like this: 1. In the notebook, click "Share" in the upper right. 2. **Do not share with me by entering my email.** Instead, go to *General Access*, and in the pulldown menu select "Anyone with the link", then set the permissions to "Commenter". 3. Then click "Copy Link". 4. **On Blackboard**, go to the *Assignments* area, then *Miniprojects*. Select Miniproject 4. 5. Under **Assignment Submission**, where it says *Text Submission*, click "Write Submission". 6. **Paste the link to your notebook in the text area that appears.** 7. Then click "Submit" to submit your work. I will then evaluate your work using the link. Specific comments will be left on the notebook itself. General comments will be left on Blackboard.

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully