nm

11353 Reputation

20 Badges

13 years, 20 days

MaplePrimes Activity


These are questions asked by nm

To obtain the columns of matrix as a list, this is what I currently do

A:=Matrix([[1,2,1,3,2],[3,4,9,0,7],[2,3,5,1,8],[2,2,8,-3,5]]);

Now

[seq(A[..,i],i=1..4)];

Also this does it

map(i->A[..,i],[$1..4]);

Is there a "shorter" way to do it?  For example, A[..,[$1..4]] does not do it ofcourse, it just gives the matrix itself back.

 

 

I do not understand what ColumnSpace is doing in Maple, as I can't get it to match my hand solution and the book. It must be using different definition which is not the book standard.

In the textbook, it says to find column space of matrix A, is to find the Echelon form, then lookup the pivot columns. Then pick the corresponding columns from the original A. These are the column space.

I'll show the book example, and Maple code to try to get same answer.

Here is an example from the book

Notice the columns space are the first, second and fourth columns of A. Since these correspond to the pivot columns of the Echelon form.

In Maple, the Echelon is found using LinearAlgebra:-GaussianElimination(A,'method'='FractionFree'); which gives the same pivot columns as the book. So far so good (the numbers are not the same, but this is normal, as Echelon form is not unique. Only reduced Echelon form is unique), but as long as the pviot columns are correct, that is the important part. 

But when I do LinearAlgebra:-ColumnSpace(A); I get completely different result. The only thing I could see in help, is that it says The Vectors are returned in canonical form with leading entries 1.

I do not underand what that means or how to convert Maple answer to make it match the expeted result since the result is completely different and I do not see the mapping needed.

restart;
A:=Matrix([[1,2,1,3,2],[3,4,9,0,7],[2,3,5,1,8],[2,2,8,-3,5]]);
LinearAlgebra:-GaussianElimination(A,'method'='FractionFree');
LinearAlgebra:-ColumnSpace(A);


I also tried this on Wolfram Alpha, and got same answer as the book

 

 

Maple 2020.1

reference: Differential Equations and linear algebra, 4th ed., Edwards, Penney and Calvis. Pearson. 2017. page 247.

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

I remember seeing sometime ago an option called something like "fraction free" in LinearAlgebra. But may be I was looking at something else or different package. I can't remember now. I searched the help pages now and googled and can't find it.

In Maple, when asking for eigenvectors of matrix, I'd like the vectors to come out fraction free, like with Mathematica.

It is ofcourse easy to write code to post process this and remove the fractions.

But before I do this, I thought to ask. Here is an example

restart;
A:=Matrix([[48,-30,-14,1],[65,-41,-19,0],[17,-10,-5,3],[-35,22,10,0]]);
(e,v):=LinearAlgebra:-Eigenvectors(A);

In Mathematica:

Anyone knows if such option exists somewhere?

Maple 2020.1

In this example, PDEtools:-Solve throws an error, while solve returns empty solution.

Why the different behavior? Should PDEtools:-Solve also return empty solution like solve?

I noticed this, when I changed my code from using solve to using PDEtools:-Solve

restart;
eq:=[ eta1+2*eta2 = 0, eta1+2*eta2 = a1+a3, eta2 = a2+2*a3];
PDEtools:-Solve(eq,[a1, a2, a3]);


solve(eq,[a1, a2, a3])

interface(version)
Standard Worksheet Interface, Maple 2020.1, Windows 10, July 30 

   2020 Build ID 1482634


Physics:-Version()

The "Physics Updates" version in the MapleCloud is 832 and is 

   the same as the version installed in this computer, created 

   2020, October 3, 5:34 hours Pacific Time.


Maple 2020.1 

First 110 111 112 113 114 115 116 Last Page 112 of 199