MCS 471 --- Computer Problem 3 --- Fall 2004
Computational Linear Algebra and Multidimensional Zeros:
MATLAB and Maple Computation
MATLAB m-File/Output and Maple Worksheets
Due Monday 15 November 2004
A. MATLAB Computational Linear Algebra Introduction Part:
Use MATLAB for this part of the assignment.
You must hand in a well documented MATLAB m-File
(see help function and use
the MATLAB Command Window Menu File's Submenu New to create an m-file
window) with useful comments and your Command Window Output.
- Part A.1: Random Test Matrix and Vector Problem:
- Create a 6 by 6 random matrix a and a 6 by 1
random vector times 100.0 b
using the MATLAB rand function,
(see MATLAB help rand, e.g., b=100.0*rand(6,1););
and Solve the linear equation a*x=b for the floating
point solution vector x using MATLAB (see MATLAB backslash
"\" operator).
- Compute and print the Determinant of a
(see help det).
- Compute and print the Condition Number in the 1-Norm, 2-Norm and
infinity-Norm for a (see help cond).
Print which value is the minimum of the three.
* Do the condition number values
indicate Well-Conditioning or Ill-Conditioning?
To answer this, decide on some reasonable condition number value that
is the break-point between the two types of conditioning and print
out your answer based upon the the minimum condition number value.
- Compute and print the Residual Vector r = b - a*x where
x is the MATLAB solution from the last item; Compute and print
the residual 2-Norm; also,
find the corresponding relative residual (norm of r
divided by norm of b) and the
leading estimate to the relative solution error e (norm
of e divided by norm of x where a*e =
-r) in the default 2-Norm.
* How accurate or how good would
you say the solution x was relative to the MATLAB default
precision?
* Is this answer consistent with the conditioning question base upon
the size of the condition numbers in part 3?
- Part A.2: Multidimensional Zero Test Problem using Newton's Method:
- Solve the multidimensional zero problem given in Section C below
by the Multidimensional Newton's Method given in class,
Jk*dxk = - Fk,
xk+1 = xk + dxk,
for k=1: ... until stopping, where
x = [xi]n×1 is the x-vector,
n = 4 in the test,
F(x) = [fi(x)]n×1 is the vector of functions,
xk= [xi,k]n×1 is the
kth Newton vector iterate starting at the starting vector iterate
k=1 given in the test example below,
dxk is the kth x-increment,
is the Jacobian matrix of partial derivatives playing the usual role of the
coefficient matrix A, fi,j(x)
is the partial derivative of fi(x) with respect to xj for j=1:n and the right hand side vector is
- Solve using using MATLAB (e.g., the backslash method above with Newton's
method), stopping when the relative increment in the infinity norm,
norm(dxk,inf)/norm(xk,inf) < 0.5 e-6.
- Report your final answer xk+1
to a rounded 10 significant digits, the above norms at stopping, the
infinite norm of Fk and the condition number of
Jk in the infinity norm. Use e-notation.
B. Maple Multidimensional Zero Finding:
- Using the Maple fsolve function find
the "aproximate" vector zero {f1=0,f2=0,f3=0,f4=0} to
10 rounded digits, when the 4 functions given below when all 4 components
of x are in the range from -3 to +3 for fsolve.
Print the vector zero location x = (x1, x2, x3, x4) to 10 rounded
significant digits. Also, print out the infinite norm of the
vector zero F = (f1, f2, f3, f4) to 10 significant digits in
e-notation.
- Compare the Maple and MATLAB answers for the zero location, x
here and the final xk+1 in the infinite norm.
{Caution: There have been cases with older versions of Maple where
fsolve does not give the correct answer
for a problem like this, so if the fsolve answer does not look right,
than use Maple solve inside the evalf function and ignore
the range of x since solve does not take that option.
Remark: regular MATLAB does have a multidimensional solver for zeros,
since fzero only finds the zero of a scalar function of a scalar argument,
although fminsearch finds the mininum of a scalar function of a multidimensional argument. Also, the multidimensional Newton's method presented in class
can also used with MATAB, but the Jacobian of the derivatives in needed.}
C. Vector Function for 4 Dim Test Example:
Let x=(x1,x2,x3,x4) and
f(x)=(f1(x),f2(x),f3(x),f4(x))
be column vectors, while J[f](x) is the n by n Jacobian
matrix of f evaluated at x. The component functions
are given by
f1(x1,x2,x3,x4) = 1.325*x1*x1 + 4.231*x2*x2 + 2.312*x3*x3+3.145*x4*x4-6.182;
f2(x1,x2,x3,x4) = x1*exp(x1)-x2-2*x3-3*x4-2.453;
f3(x1,x2,x3,x4) = x1-3.451*x2+2.718*x3-1.144*x4-5.786;
f4(x1,x2,x3,x4) = 1.342*x1+2.768*x2+3.898*x3+4.231*x4-2.939;
Use the starting vector iterate
x = (x1,x2,x3,x4) = (+1.0,-1.0,+1.0,0.2)
MATLAB and Maple Web References:
Refer to the Class MATLAB and Maple Pages, or in particular to the
quick help linear algebra pages are suggested:
Web Source: http://www.math.uic.edu/~hanson/mcs471/cp3f04.html
Email Comments or Questions to Professor Hanson
hanson A T math uic edu
Click Here For Class Home Page