Next: Question 7: Can Up: Some Maple Questions and Previous: Question 5: Now

Question 6: I have assigned a matrix to A. If I just type A; all I get is the name A. I don't see the matrix. Why is this different from a polynomial and how can I see the matrix?

Answer: Matrices are a special type of an array. Arrays (and tables) have special evaluation rules in Maple. If they are named, the name only evaluates to itself but, it points to the matrix data structure. Think of it this way: the name of a polynomial is a variable which contains the polynomial while the name of a matrix is a variable which points to the matrix but contains its own name.

There are several ways to ``see'' the matrix. eval(A) returns the matrix data structure which is interpreted by the prettyprinter and printed the way you want to see it. print(A) will also display the matrix.


> A:=linalg[matrix](2,2,max);
                                      [ 1  2 ]
                                 A := [      ]
                                      [ 2  2 ]

> A;
                                       A

> eval(A);
                                    [ 1  2 ]
                                    [      ]
                                    [ 2  2 ]

> print(A);
                                    [ 1  2 ]
                                    [      ]
                                    [ 2  2 ]

Related help pages include: print, eval, matrix, array, prettyprinter, op.


gagin@thsun1.jinr.ru