Question: how to use Jordan form inside a proc?

I know this has to do with name scoping issue. But I do not see how to fix it now.

Calling J,Q:=LinearAlgebra:-JordanForm(A,output=['J','Q']); works in global, but not inside a proc.

What is the correct way to use this inside a proc?


 

restart;
A:=Matrix([[1,2],[3,4]]);
J,Q:=LinearAlgebra:-JordanForm(A,output=['J','Q']);

Matrix(2, 2, {(1, 1) = 1, (1, 2) = 2, (2, 1) = 3, (2, 2) = 4})

Matrix(%id = 18446745500542083790), Matrix(%id = 18446745500542076678)

restart;
foo:=proc(A::Matrix)
local J,Q;
J,Q:=LinearAlgebra:-JordanForm(A,output=['J','Q']);
end proc;
A:=Matrix([[1,2],[3,4]]);
foo(A);

foo := proc (A::Matrix) local J, Q; J, Q := LinearAlgebra:-JordanForm(A, output = ['J', 'Q']) end proc

Matrix(%id = 18446745500542658910)

Error, (in foo) invalid input: LinearAlgebra:-JordanForm expects value for keyword parameter output to be of type {list(identical(J, Q)), identical(J, Q)}, but received [J, Q]

 


 

Download jordan_issue.mw

Please Wait...