DOC PREVIEW
UW-Madison CS 525 - Homework

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Homework 1∗†CS 525The data for this problem, namelyA =1 3 −20 −2 1, B =1 −2 1−3 2 11 1 1, C =−1 42 1−2 5,x =120132, y =−13−30−21, b =2−10, α = −2,can be loaded from hwk1.mat by issuing within MATLAB the load hwk1 command inMATLAB. Make sure you generate a diary file containing your MATLAB session asexplained in the one-page MATLAB setup class handout, also available on the web at:http://www.cs.wisc.edu/∼cs525-1. Feel free to annotate by hand the resulting diary file toadd explanation.Make sure that your diary file contains the lines: diary hwk1.login type hwk1run.m; echo on; hwk1run %end hwk1 diary offRather than typing in all the commands line by line, write a MATLAB script-file“hwk1run.m” that has the appropriate commands on separate lines to carry out the requiredsteps. The above commands list “hwk1run.m” and the results of executing the commandsin your m-file “hwk1run” in the diary file. To generate a printout to hand in, you should useprint -2up hwk1.login∗The assignment name is hwk1 and the file to be handed in is “hwk1.login” (where login in your loginname). The homework is due in class, one week after assigned. No late homework accepted.†You may wish to refer to Appendix B of the text or the “MATLAB Primer”, available from the courseweb page for details about MATLAB for this assignment.1A diary file of this form with all the MATLAB commands listed and yourname clearly indicated is required for this and all subsequent homeworks. Markswill be deducted if these instructions are not followed.More credit will be given for shorter (MATLAB) answers. Note that within MATLAB,help command gives help information on “command”.1. Clear the workspace of all variables (help clear)2. Load the data from hwk1.mat and print out a list of all the variables currently in scope(help whos, help who)3. Calculate 2A − αC04. Calculate v, where vi= xi/yioutputing the solution immediately (help rdivide).Explain any odd output you may see.5. Calculate mini=1,2,...,6vi(help min). How would you calculate argmini=1,2,...,6vi?6. Read section 2.5 of the class text to recap the notion of an LU decomposition. Calculatean LU decompositition of B (help lu). Use a permutation matrix P and ensurethat L and U are really triangular (help spy would show this - I want you to showalgebraically that the matrices are trainagular). Check that P B = LU holds for yourcomputed solution by finding (and printing) the element of the matrix that differs bythe most (help max, help abs). How is the inverse of P related to P ?7. Find a vector p (called a permutation index vector) such that B(p, :) = LU. WriteMATLAB code to extract this vector from P automatically (help find)8. Overwrite the vector x with the solution of Bx = b using the technique outlined nearthe top of page 41 of the class text. Is this solution x unique? How would you updatethe technique on page 41 to use p instead of P ?9. Extract the diagonal of (the computed) U into a vector d (help diag), then sum upall the elements of d and print out the result with at least 10 figures of accuracy (helpformat).10. Calculate w = (x5, x4, x1, x3, x2, x6) as a row vector. You may want to think aboutusing a permutation index vector.11. Calculate D = AA0without printing anything, but print out the minimum eigenvalueof D (help eig)12. What can you say about minuu0Du/u0u? (Hint: is this ratio positive for all choices ofu? how is the ratio related to the minimum eigenvalue found above).


View Full Document

UW-Madison CS 525 - Homework

Download Homework
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Homework and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Homework 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?