Post Reply 
Calculation of determinant on HP-15C
03-11-2021, 11:39 PM
Post: #14
RE: Calculation of determinant on HP-15C
(03-10-2021 09:09 AM)NumberJack Wrote:  I computed the determinant of a 4x4 matrix on the HP-15C. All coefficients of the matrix are small integers. I know the determinant is 0, but the HP-15C returns "2.1000 -10" in the display, which is a very small number but not 0.

This happens because, though computing a determinant is an operation which theoretically requires just multiplications and additions/subtractions but no divisions, the algorithm used in the HP-15C and most other calculators/pocket computers (if not all) does use divisions by pivots, and those divisions very rarely come out exact but usually introduce very small rounding/truncation errors which, as the algorithm requires a large number of arithmetic operations, eventually delivers non-exact results even when all the matrix elements are small integers.

Quote:Is there a way to get the "correct" determinant?

The only way to avoid this (apart from using exact rational arithmetic or symbolic results) would be to use an algorithm that does not use divisions. There are a number of them but whether they would fit in the HP-15C's program memory and still allow space for a 4x4 matrix is quite another question, and I would say that fitting both the program and the 4x4 matrix and other ancillary variables plus doing the computation in reasonable times would be quite diffcult if not impossible.

For models such as the HP-42S upwards (HP-71B and the RPL models) it's quite possible and not particularly difficult. For example, have a look at Example 5 (pages 8-9) in this article (PDF) of mine, which demonstrates the algorithm by exactly computing the determinant of a 7x7 matrix with all small integer elements.

V.

  
All My Articles & other Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Calculation of determinant on HP-15C - Valentin Albillo - 03-11-2021 11:39 PM



User(s) browsing this thread: 1 Guest(s)