HP Forums
Pivot-ing of matrix does not work - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Pivot-ing of matrix does not work (/thread-21945.html)



Pivot-ing of matrix does not work - DG7RBN - 06-25-2024 03:33 PM

pivot(matrix,n,m) throws an error message: "Error: Bad Argument Type".
Even the simple example from the "Help" or the manual p.527 does not work !?!
Any ideas or is it a bug ? (SW version 2023 04 13)
Regards
Andreas


RE: Pivot-ing of matrix does not work - ftneek - 06-25-2024 04:01 PM

It only works when 'Exact' mode is turned on in CAS settings (checked in VC 14425).


RE: Pivot-ing of matrix does not work - jte - 06-25-2024 09:33 PM

While the type of operation pivot is doing is certainly entirely appropriate in some problem domains (when you don't have division, or are wanting to avoid it), I would think this too often runs counter to the assumptions (/ teachings) of introductory linear algebra courses (when using the phrase “Gaussian elimination” and the matrices are matrices of real numbers). So it would seem that something should be adjusted here. (At a minimum, perhaps just the help text.) (Some might teach a Gaussian elimination of this form, but many do not, in introductory linear algebra courses.)


RE: Pivot-ing of matrix does not work - parisse - 06-26-2024 06:36 AM

Ok, let's divide by the pivot after linear combination.


RE: Pivot-ing of matrix does not work - DG7RBN - 06-26-2024 02:03 PM

@neek: Thank you very much for the quick answer. It works also with V14730.

@Jeff: As you stated, a hint in the help file / manual would have instantly solved the problem. The "good ol' HP49G" even warns you with a beep when CAS wants you to use exact calculation.

It's a shame that the last edition of the manual of a top notch pocket calculator is now SEVEN years old. At the Moravia web site the manual to download is even NINE years old... and no perspective for an update.

Thanks
Andreas


RE: Pivot-ing of matrix does not work - KeithB - 06-26-2024 03:08 PM

Though it does not help in this case, even the hp folks said that the help system was way more current than the manual.


RE: Pivot-ing of matrix does not work - parisse - 06-27-2024 05:27 AM

(06-25-2024 09:33 PM)jte Wrote:  (Some might teach a Gaussian elimination of this form, but many do not, in introductory linear algebra courses.)
Unfortunately most math teachers ignore the most efficient way to reduce integer matrices by hand. They make a linear combination like this (I assume for simplicity that the matrix is not singular and pivots are on the diagonal):
M[j]=M[j]-M[j][j]/M[pivotline][j]*M[pivotline]
This will introduce fractions, therefore take more time to compute, and it raises the risk to make a computation error.

The more efficient method is called Gauss-Bareiss, it works like this:
M[j]=(M[pivotline][j]*M[j]-M[j][j]*M[pivotline])/(pivot_used_to_reduce_previous_column)
It does not introduce fractions while keeping coefficients not too large.
Addtionally, if you are using reduction to compute a determinant, then run Gauss-Bareiss under the diagonal, once reduced, the determinant is the last diagonal coefficient.


RE: Pivot-ing of matrix does not work - jte - 06-27-2024 05:50 AM

(06-27-2024 05:27 AM)parisse Wrote:  
(06-25-2024 09:33 PM)jte Wrote:  (Some might teach a Gaussian elimination of this form, but many do not, in introductory linear algebra courses.)
Unfortunately most math teachers ignore the most efficient way to reduce integer matrices by hand. They make a linear combination like this (I assume for simplicity that the matrix is not singular and pivots are on the diagonal):
M[j]=M[j]-M[j][j]/M[pivotline][j]*M[pivotline]
This will introduce fractions, therefore take more time to compute, and it raises the risk to make a computation error.

The more efficient method is called Gauss-Bareiss, it works like this:
M[j]=(M[pivotline][j]*M[j]-M[j][j]*M[pivotline])/(pivot_used_to_reduce_previous_column)
It does not introduce fractions while keeping coefficients not too large.
Addtionally, if you are using reduction to compute a determinant, then run Gauss-Bareiss under the diagonal, once reduced, the determinant is the last diagonal coefficient.

Big GrinBig GrinBig Grin & here I was... resisting... resisting... resisting... mentioning Bareiss. Wink Yes, it's a standard way to control the growth of integer matrix elements during elimination. So it's great you brought it up Smile You gave me a good laugh (much appreciated!) tonight! Smile I'm glad I resisted!

(Post edited as I had U+1F602 [FACE WITH TEARS OF JOY] instead of Big Grin, but it seems such emoji can't be included directly in posts. Too much joy for mybb to encode succinctly?)