[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Inverse Matrix Function appears a bit wonky
From: |
Paul Laub |
Subject: |
Re: Inverse Matrix Function appears a bit wonky |
Date: |
Wed, 3 Nov 2004 13:07:07 -0800 |
Robert,
Your arbitrary test matrix is ill-conditioned so any attempt to invert
is bound to produce numerical inaccuracy, or worse. Try this
>> [testmatrixinverse, rcond] = inv( testmatrix )
and note that rcond (the reciprocal condition number) is very small (I
get 5.6e-18). When rcond gets down to machine precision (global
constant eps = 2.2e-16), you might as well forget about precision and
accuracy. For another example, try hilb(n) * inv(hilb(n)) for n = 1,
2, ..., 15. The Hilbert matrix is famously illconditioned for large n.
Paul Laub
On Wed, 03 Nov 2004 12:43:30 -0800, Robert A. Macy <address@hidden> wrote:
> I tried a simple test of the inverse function using a "made
> up" matrix...
>
> testmatrix =
> 1 2 3 4
> 2 2 3 3
> 1 2 1 2
> 3 2 2 1
>
> forgive the wraparound results...
> testmatrixinv = inverse(testmatrix) =
> -3.37769972052787e+15 4.5035996273705e+15
> 1.12589990684262e+15 -2.25179981368525e+15
>
> 3.37769972052787e+15 -4.5035996273705e+15
> -1.12589990684262e+15 2.25179981368525e+15
>
> 3.37769972052787e+15 -4.5035996273705e+15
> -1.12589990684262e+15 2.25179981368525e+15
>
> -3.37769972052787e+15 4.5035996273705e+15
> 1.12589990684262e+15 -2.25179981368525e+15
>
> inverse function merrily calculated the above inverse
> matrix with no special notes.
>
> but when I multiply the two, the results are...
> testmatrixinv*testmatrix =
> 1 0 1 -1
> 0 1 0 1.5
> -1 -0.5 1 1
> 1 0.5 0.5 0.25
>
> which is definitely NOT the identity matrix
>
> the testmatrix was just an arbitrary matrix to test the
> process. It is very disconcerting that the first,
> arbitrary test, fails so miserably. What happened?
>
> What do I do to make certain octave doesn't do these
> erroneous inverse calculations the next time I go to use
> the inverse function?
>
> - Robert -
>
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
>
> Octave's home on the web: http://www.octave.org
> How to fund new projects: http://www.octave.org/funding.html
> Subscription information: http://www.octave.org/archive.html
> -------------------------------------------------------------
>
>
--
Safe Harbor Disclaimer: "Elvis has left the building."
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
- Inverse Matrix Function appears a bit wonky, Robert A. Macy, 2004/11/03
- Re: Inverse Matrix Function appears a bit wonky, Dmitri A. Sergatskov, 2004/11/03
- Re: Inverse Matrix Function appears a bit wonky, Robert A. Macy, 2004/11/04
- Re: Inverse Matrix Function appears a bit wonky, David Bateman, 2004/11/04
- Re: Inverse Matrix Function appears a bit wonky, John W. Eaton, 2004/11/04
- Re: Inverse Matrix Function appears a bit wonky, David Bateman, 2004/11/05
- Re: Inverse Matrix Function appears a bit wonky, John W. Eaton, 2004/11/05
- Re: Inverse Matrix Function appears a bit wonky, David Bateman, 2004/11/05