[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #58398] Given an integer matrix, the character
From: |
Kai Torben Ohlhus |
Subject: |
[Octave-bug-tracker] [bug #58398] Given an integer matrix, the characteristic polynomial has none integer value |
Date: |
Tue, 19 May 2020 01:49:55 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36 |
Update of bug #58398 (project octave):
Severity: 3 - Normal => 2 - Minor
Priority: 5 - Normal => 3 - Low
Status: None => Invalid
Open/Closed: Open => Closed
_______________________________________________________
Follow-up Comment #1:
Thank you for your report. This problem seems to occur due to the nature of
numerical software. The claim "roots(poly(A)) = eig(A)" is only approximately
valid in numerical mathematics and strongly dependent on your problem data.
Your matrix `A` may be stored with full precision, but as soon as you convert
it into a polynomial, numerical computations are performed. Double precision
is insufficient to perform this conversion with full accuracy. Your
polynomial is only an approximation. This effect grows with the matrix size.
>> max (poly (A))
ans = 55572125.19238
>> min (poly (A))
ans = -3317398.57544
Your observation, that "roots(poly(A)) = eig(A)" does not hold only for your
matrix at N=100, but for other random integer matrices, is not necessarily
true. Using random integer matrices, e.g.,
N=300;
A=randi ([-1, 1], N);
e=eig(A);
p=roots (poly (A));
figure;
plot(real(e),imag(e),'ro');hold on;
plot(real(p),imag(p),'gx');hold off;
axis equal
the difference becomes obvious at larger dimensions, as well.
Matlab R2019a does not behave better than Octave for your example code.
How to overcome this issue?
- Know about the structure of your matrix, and search in literature about
specialized numerical methods treating that structure accurately.
- Use symbolic calculation (your problem dimensions are not too large).
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?58398>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/