Question: why convert(array,Matrix) display is different?

I have an Array A which I wanted to convert to Matrix. Doing B:=convert(A,Matrix); displays different on the screen than if A is first converted to list, then the list is next converted to Matrix.

Also the dimension in the first case if not the same as the dimension of the matrix done using the list conversion first. I expected both to give same dimension which is 10 by 3 in this example.

Should not both be the same? Does this to convert an Array to Matrix, one first needs to convert it to list, then convert the list to Matrix?

ps. thinking more about this, I think this seems to work as designed. I just expected convert to Matrix to generate the standard 2 dimensional matrix  10 by 3 automatically from the Array, but I see now that it probably does need that extra conversion to a list first.

 


 

interface(version);

`Standard Worksheet Interface, Maple 2022.1, Windows 10, May 26 2022 Build ID 1619613`

restart;

A:=Array(1..0);
for i from 1 to 10 do
   A ,= [i, i+1, i+2]
od:
B:=convert(A,Matrix);
whattype(B);
LinearAlgebra:-Dimension(B);

A := Vector[row](0, {})

Matrix(%id = 36893490060059048044)

Matrix

1, 10

restart;
A:=Array(1..0);
for i from 1 to 10 do
   A ,= [10-i, i+1, i+2]
od:
B:=convert(A,list);
B:=convert(B,Matrix);
whattype(B);
LinearAlgebra:-Dimension(B);

A := Vector[row](0, {})

B := [[9, 2, 3], [8, 3, 4], [7, 4, 5], [6, 5, 6], [5, 6, 7], [4, 7, 8], [3, 8, 9], [2, 9, 10], [1, 10, 11], [0, 11, 12]]

Matrix(%id = 36893490060058557844)

Matrix

10, 3

 

 


 

Download oct_25_2022.mw

Please Wait...