how to use unexposed operation addrows!

5 views
Skip to first unread message

张志雄

unread,
Jul 5, 2023, 6:07:11 AM7/5/23
to FriCAS - computer algebra system
It seems there are functions to do row operations as described in below url: https://fricas.github.io/api/LinearMultivariateMatrixPencil.html

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.

Please let me known if I misunderstand it.

Ralf Hemmecke

unread,
Jul 5, 2023, 6:39:16 AM7/5/23
to fricas...@googlegroups.com
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

张志雄

unread,
Jul 5, 2023, 8:42:57 AM7/5/23
to FriCAS - computer algebra system
Thank you, Ralf,


I am tring to teaching linear algebra using friCAS.
I want to show how to get the rank of a matrix in a more detailed way although there is a function rank. 
I have run this tow lines with the same message:  There are no exposed library operations named qnew having 3
      argument(s) though there are 1 unexposed operation(s) with 3 argument(s).
Sky 
Reply all
Reply to author
Forward
0 new messages