mm245/ma260 lab2
http://www.maths.nuigalway.ie/~gettrick/teach/mm245/labs/l2.html
-
As well as coming to the supervised lab - you are expected
to work on this lab on your own outside of lab hours (in your own time).
-
For this lab you must submit all source code (matlab/scilab/octave .m files).
The code should have comments of explanation, with at least as many
comments as code.
This should be sent in via BLACKBOARD (not directly by email).
Any questions asked should be answered by
typing into a plain text (.txt) file (or inserted at
the end of MATLAB/SCILAB/OCTAVE code after the percentage (comment) symbol)
which should also
be uploaded via blackboard.
-
This material should be uploaded
before
the deadline of 5pm
Friday October 11th, 2013. You will lose 20% for each day
(or part of day) the lab is late.
-
Plagiarism (the unattributed copying of work from other sources
(internet, fellow students,....)) will not be tolerated. Please see
http://www.nuigalway.ie/engineering/documents/plagiarism_guide_students
_v4.pdf. You risk getting zero for your lab if it is found to be
plagiarized.
-
If you are really stuck:
-
Ask in the lab
-
Post a question in the Discussion Board in BLACKBOARD
You should first read the code in
fixedp1.m at
http://www.maths.nuigalway.ie/~gettrick/teach/mm245/labs/matlab/
and try to understand it.
For this lab
-
Consider the "problem" of finding the square root of two, i.e. the
root of f(x)=x**2-2. Consider the fixed point iterations
-
g1(x) = x/2 + 1/x
-
g2(x) = 2*x/3 + 2/(3*x)
Calculate the order of convergence for both
g1(x) and g2(x).
(You don't need MATLAB/SCILAB/OCTAVE to do this!)
-
Write MATLAB code to carry out iterations using g1(x)
starting at the point x0 = 100. How many iterations are
needed to obtain the square root of two to 9 decimal places
(i.e. 1.414213562)?
-
Write MATLAB code to carry out iterations using g2(x)
starting at the point x0 = 2. How many iterations are
needed to obtain the square root of two to 9 decimal places
(i.e. 1.414213562)?
-
For your second MATLAB program (using g2(x)): Determine the
relative error at each step in your calculation, using
1.414213562 as the actual square root of two.
©
NUI, Galway