User Tools

Site Tools


gibson:teaching:fall-2014:iam961:hw5

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
gibson:teaching:fall-2014:iam961:hw5 [2014/12/08 10:48]
gibson
gibson:teaching:fall-2014:iam961:hw5 [2014/12/14 05:08] (current)
gibson
Line 28: Line 28:
 2. Let $x$ be a random M vector with normally-distributed components. Let $b = A x$.  2. Let $x$ be a random M vector with normally-distributed components. Let $b = A x$. 
  
-3. Do the GMRES iteration and plot the normalized residual $\| A x_n - b\|/\|b\|$ and the normalized $x$ error $\| x_n - x \|$ as a function of the iteration number $n$. Plot the residual with circles and the error with dots, put them on the same plot, and use a logarithmic axis. +3. Do the GMRES iteration and plot the normalized residual $\| A x_n - b\|/\|b\|$ and the normalized $x$ error $\| x_n - x \|$ as a function of the iteration number $n$. Plot the residual with circles and the error with dots, put them on the same plot, and **use a logarithmic axis for the errors**: e.g. ''​semilogy(n,​error,'​b.',​n,​residual,'​ro'​)''​
  
-Set $M$ to a fairly ​small number, like 20 or 30 and produce ​three residual-and-error plots, for  $\kappa=100$,​ $\kappa=10^6$, $\kappa=10^16$+For testing and developing your code, set $M$ to a small number ​like 10 and $\kappa$ to $10^8$. Your GMRES code should go all the way to $n=M$ iterations. Your code should have a for-loop to handle iterations $n=1$ to $M-1$ followed by some special-case code to handle the last $n=M$th iterate --the last iteration works a little differently.  
 + 
 +Once your code is working (the residual is $10^{-16}$ at the last iterate)set $M$ to a moderately small number ​like 30 and produce ​four residual-and-error plots, for  $\kappa=100$,​ $\kappa=10^8$, $\kappa=10^{16}$, and $\kappa=10^{32}$. 
 + 
 +Discuss your results. Is anything surprising? What can you explain about the behavior of the plots, given what you know about GMRES and $Ax=bproblems in general?
  
gibson/teaching/fall-2014/iam961/hw5.1418064493.txt.gz · Last modified: 2014/12/08 10:48 by gibson