Hi, and welcome to FriCAS!

On 05.07.23 11:56, 张志雄 wrote:
It seems there are functions to do row operations as described in below
url: https://fricas.github.io/api/LinearMultivariateMatrixPencil.html

The functions description is correct, you are just not using it the way it is supposed to be used.

But it shows error when i try to use them as below:

-> C := matrix[[1,2],[3,4]]
-> addrows!(C,1,2,-3)

There are no library operations named addrows!
       Use HyperDoc Browse or issue
                               )what op addrows!
       to learn if there is any operation containing " addrows! " in its
name.
Cannot find a definition or applicable library operation named addrows!
with argument type(s)
                                Matrix(Integer)
                                PositiveInteger
                                PositiveInteger
                                    Integer
Perhaps you should use "@" to indicate the required return type,
       or "$" to specify which version of the function you need.

FriCAS is working as expected here, but maybe not the way you expected it. Note that it says that it cannot fine a function addRows! that has (in particular) Matrix(Integer) as its first argument type. The type on the above website lists % as the type of the first argument. So this is what you will have to provide.

I had to look up myself how this can actually be done. Strangely this domain seems to be rather cumbersome to work with, at least for the creation of a pencil. Maybe we should add a function that can coerce a list of matrices into the pencil domain.

Hopefully, the following will enable you to go further. Otherwise, pose the actual problem you want to solve.

(3) -> PEN==>LinearMultivariateMatrixPencil(Integer)

(9) -> r:=4; c:=3; l:=2; pen := qnew(r, c, l)

         +0  0  0+  +0  0  0+
         |       |  |       |
         |0  0  0|  |0  0  0|
   (9)  [|       |, |       |]
         |0  0  0|  |0  0  0|
         |       |  |       |
         +0  0  0+  +0  0  0+
                    Type: LinearMultivariateMatrixPencil(Integer)
(10) -> for i in 1..r repeat for j in 1..c repeat for k in 1..l repeat pen(i,j,k) := random(10)
                    Type: Void
(11) -> pen

          +6  5  3+  +9  1  5+
          |       |  |       |
          |4  7  9|  |0  4  1|
   (11)  [|       |, |       |]
          |1  7  8|  |3  2  9|
          |       |  |       |
          +1  9  0+  +7  8  5+
                     Type: LinearMultivariateMatrixPencil(Integer)
(12) -> addRows!(pen,2,1,2)

          +14  19  21+  +9  9  7+
          |          |  |       |
          |4   7   9 |  |0  4  1|
   (12)  [|          |, |       |]
          |1   7   8 |  |3  2  9|
          |          |  |       |
          +1   9   0 +  +7  8  5+
                       Type: LinearMultivariateMatrixPencil(Integer)

Ralf

--
You received this message because you are subscribed to the Google Groups "FriCAS - 
computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fricas-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/f0e6e7ed-f607-19c3-30c2-1a05f41d859e%40hemmecke.org.

Reply via email to