Comments on: A Roman Numeral Object, with Arithmetic, Matrices and a Clock https://blogs.mathworks.com/cleve/2017/04/24/a-roman-numeral-object-with-arithmetic-matrices-and-a-clock/?s_tid=feedtopost Cleve Moler is the author of the first MATLAB, one of the founders of MathWorks, and is currently Chief Mathematician at the company. He writes here about MATLAB, scientific computing and interesting mathematics. Mon, 01 May 2017 20:03:54 +0000 hourly 1 https://wordpress.org/?v=6.2.2 By: José-Javier Martínez https://blogs.mathworks.com/cleve/2017/04/24/a-roman-numeral-object-with-arithmetic-matrices-and-a-clock/#comment-6177 Mon, 01 May 2017 20:03:54 +0000 https://blogs.mathworks.com/cleve/?p=2437#comment-6177 Thank you very much, Professor Moler, for you kind answer. I had used your file “lugui” for our matrix A = pascal(4), and the permutation vector is p=(1,4,3,2), which means only one permutation is carried out: P24.
I have revised the example with “lu” of my new version of MATLAB and thanks to your suggestion I have seen the answer: After the elimination of the second column, the last two entries in the third column are -1,-1. Due to finite precision arithmetic, the second one seems to be identified as greater and selected as pivot, which implies a second permutation: P34. Consequently, the permutation vector given by “lu” is now p=(1,4,2,3).
I see that, fortunately, there is no random interchange, only the effect of finite precision arithmetic (which, as we see, works a bit differently with the built-in function “lu” and with your teaching codes “lutx” and “lugui”).
I like these Pascal matrices very much for their interesting properties. For instance, when using Neville elimination (in exact arithmetic) all the entries revealed by elimination are equal to one. Using the expression of P. Koev, BD(A) = ones(n,n) if A is a Pascal matrix or order n.
Thank you again for your work.

]]>
By: Cleve Moler https://blogs.mathworks.com/cleve/2017/04/24/a-roman-numeral-object-with-arithmetic-matrices-and-a-clock/#comment-6176 Mon, 01 May 2017 15:12:19 +0000 https://blogs.mathworks.com/cleve/?p=2437#comment-6176 In reply to José-Javier Martínez.

Hi — Welcome to MATLAB. With pivoting, the LU factorization of a matrix is not unique. If there are several elements in the pivoting column that all have the same maximum magnitude, any one of them can be chosen as the pivot. For example
A = [1 2; 1 1].
If A(1,1) is chosen as the first pivot, then
[1 0; 1 1]*[1 2; 0 -1] = A
But if A(2,1) is chosen as the first pivot, then
[1 0; 1 1]*[1 1; 0 1] = A([2 1],:)
Both are legitimate LU factorizations of A.
Different codes are free to make different choices.uu
Take a look at “lugui” from “Numerical Computing with MATLAB.
https://www.mathworks.com/matlabcentral/fileexchange/37976-numerical-computing-with-matlab
— Cleve

]]>
By: José-Javier Martínez https://blogs.mathworks.com/cleve/2017/04/24/a-roman-numeral-object-with-arithmetic-matrices-and-a-clock/#comment-6175 Sat, 29 Apr 2017 19:10:48 +0000 https://blogs.mathworks.com/cleve/?p=2437#comment-6175 Dear Professor Moler: this comment is not closely related to the subject of this beautiful post (I live in the roman city Complutum), but it is related to solving linear equations. This week I have just begun to use MATLAB R2016b, and my first example was LU factorization, with the matrix A=pascal(4). I have found that [L,U,P]=lu(A) introduces an extra row permutation, which your code lutx.m does not perform (nor previous versions of MATLAB). Has MATLAB introduced some novelty (not explained in textbooks) concerning the ordering of rows in partial pivoting?
I would like to have your answer, which may be useful for many teachers/researchers. Thank you very much for your wonderful work.

]]>