inconsistent condition numbers from cond, det, inv functions
Ben Abbott
bpabbott at mac.com
Thu Feb 7 06:13:43 CST 2008
On Feb 7, 2008, at 7:00 AM, Rolf Fabian wrote:
> [...]
>
> Unfortunately example matrix x was choosen to be symmetric.
> This wasn't a good choice because Inf- and 1-norms are
> idential in this case.
>
> Using instead the asymmetric matrix
> octave-3.0.0.exe:> y=[7,2,3;1,3,4;6,4,5]
> y =
> 7 2 3
> 1 3 4
> 6 4 5
>
> octave-3.0.0.exe:> 1/condh(y,1)
> ans = 0.017460
> octave-3.0.0.exe:> 1/condh(y,2)
> ans = 0.019597
> octave-3.0.0.exe:> 1/condh(y,'fro')
> ans = 0.018714
> octave-3.0.0.exe:> 1/condh(y,'inf')
> ans = 0.012022
> octave-3.0.0.exe:> 1/condh(y,Inf)
> ans = 0.012022
>
> octave-3.0.0.exe:37> [dum,rc1]=det(y)
> rc1 = 0.017460
> octave-3.0.0.exe:38> [dum,rc2]=inv(y)
> rc2 = 0.017460
> octave-3.0.0.exe:39> rc3 = 1/cond(y)
> rc3 = 0.019597
>
> allows to differentiate between 1- and Inf -norm.
>
> Ben, what' s the result for 1./cond(y) ?
> Does Matlabs cond() have a similar argument 'p' too?
Yes!
>> y=[7,2,3;1,3,4;6,4,5]
y =
7 2 3
1 3 4
6 4 5
>> 1/cond(y)
ans =
0.0196
>> help cond
COND Condition number with respect to inversion.
COND(X) returns the 2-norm condition number (the ratio of the
largest singular value of X to the smallest). Large condition
numbers indicate a nearly singular matrix.
COND(X,P) returns the condition number of X in P-norm:
NORM(X,P) * NORM(INV(X),P).
where P = 1, 2, inf, or 'fro'.
Class support for input X:
float: double, single
See also rcond, condest, condeig, norm, normest.
Reference page in Help browser
doc cond
>> 1/cond(y,1)
ans =
0.0175
>> 1/cond(y,2)
ans =
0.0196
>> 1/cond(y,inf)
ans =
0.0120
>> 1/cond(y,'fro')
ans =
0.0187
Ben
More information about the Bug-octave
mailing list