Given$$A=\begin{bmatrix}23.89&-36.48&1.432&21.65\\-36.48&54.58&-5.193&-34.45\\1.432&-5.193&-1.0717&1.937\\21.65&-34.45&1.937&20.50\end{bmatrix}.$$ I am given the eigenvalues of $A$ as $100$, $1$, $-0.1$, $-3$, which matches with an error of $10^{-3}$ the eigenvalues given by octave
A = [23.89 -36.48 1.432 21.65; -36.48 54.58 -5.193 -34.45; 1.432 -5.193 -1.0717 1.937; 21.65 -34.45 1.937 20.50] ; >> lambdas=eig(A) lambdas = -3.001013 -0.098193 1.001209 99.996297 With the definition of the conditional number $\kappa$: $$\kappa_{2}(A) = \frac{|\lambda_{n}|}{|\lambda_{1}|},$$ I can compute the conditional number with:
kappa = abs(max(lambdas)) / abs(min(lambdas)) which gives the answer $33.333$.
However when I check the answer with the following octave command it does not match:
cond(A) which gives $1018.4$. What am I doing wrong?
$\endgroup$31 Answer
$\begingroup$The following is wrong. Corrected below
The condition number (in $L_2$ norm ) is the ratio of the maximum/minimum singular values.
This equals the ratio of the maximum/minimum (absolute values of) eigenvalues only if the matrix is symmetric (or more general, normal) which is not the case here.
>> svd(A) ans = 99.996297 3.001013 1.001209 0.098193 >> 99.996/0.098 ans = 1020.4 This matrix is normal , hence, effectively, the ratio of maximum/minimum absolute value of eigenvalues gives the number condition. But you must first take the absolute value, then select the extremes.
> kappa = max(abs(lambdas)) / min(abs(lambdas)) kappa = 1018.4 This was rightly pointed out by Parcly Taxel's comment.
$\endgroup$