The root_system function

Questions and problems about using polymake go here.
mjs
Posts: 9
Joined: 15 Mar 2019, 04:15

The root_system function

Postby mjs » 21 Mar 2019, 23:00

I am writing a script which involves constructing the vectors e_i-e_j for certain values of i and j. My current code involves a lot of looping and takes a long time, and I am sure that there must be a better way. I saw in the polymake documentation that there is a function called root_system which returns a vector configuration. I think that this could be useful to me, but I cannot figure out how to use it. I cannot find any examples online of code where it is used, and when I try to call it in the polymake shell, I get the following error:

Code: Select all

polymake > $r = root_system('A3'); polymake: ERROR: Undefined subroutine &Polymake ::User::root_system called at input line 1.
Can you help me with this function and/or direct me to someplace where I can find information about it? Alternatively, is there a different method that you would recommend for constructing standard basis vectors or vectors of the form e_i-e_j?

User avatar
gawrilow
Main Author
Posts: 423
Joined: 25 Dec 2010, 17:40

Re: The root_system function

Postby gawrilow » 21 Mar 2019, 23:46

root_system is defined in application "polytope", so you can call it by qualified name "polytope::root_system(...)". Namespace prefix can be omitted when your current application is "polytope" or "fan".

In your post, the shell prompt says "polymake" which looks suspicious - there is no such application.

mjs
Posts: 9
Joined: 15 Mar 2019, 04:15

Re: The root_system function

Postby mjs » 22 Mar 2019, 07:39

Thanks for the response! In my original post I was transcribing and I made an error -- I was actually in the polytope application. So this does not seem to explain my problem.

User avatar
joswig
Main Author
Posts: 280
Joined: 24 Dec 2010, 11:10

Re: The root_system function

Postby joswig » 22 Mar 2019, 12:02

Please tell us which polymake version your are using on which operating system. Did you compile from source code (then, please, send your file build/config.ninja), or did you use some precompiled version from some package manager (which?).

mjs
Posts: 9
Joined: 15 Mar 2019, 04:15

Re: The root_system function

Postby mjs » 26 Mar 2019, 10:20

I am using Polymake version 3.0 on the Ubuntu Linux subsystem for Windows 10. I installed polymake through the Ubuntu package manager.

User avatar
gawrilow
Main Author
Posts: 423
Joined: 25 Dec 2010, 17:40

Re: The root_system function

Postby gawrilow » 26 Mar 2019, 10:40

Sorry, your version is too old. root_system was introduced in 3.1 .

mjs
Posts: 9
Joined: 15 Mar 2019, 04:15

Re: The root_system function

Postby mjs » 26 Mar 2019, 10:57

Ah, I see. Here is the embarrassingly slow code that I came up with to construct the vector e_l-e_{l+i} for a given l and i:

Code: Select all

my $neweq = new Vector([0]); for(my $j=0;$j<$n;$j++){ if($j==$l){ $neweq = $neweq|new Vector([1]); } elsif($j==$l+$i){ $neweq = $neweq|new Vector([-1]); } else { $neweq = $neweq|new Vector([0]); } }
Is there a simple method that you would recommend for constructing certain standard basis vectors or vectors of the form e_i-e_j, without using root_system?

User avatar
gawrilow
Main Author
Posts: 423
Joined: 25 Dec 2010, 17:40

Re: The root_system function

Postby gawrilow » 26 Mar 2019, 13:51

Vectors offer random access to their elements, so simply do this:

Code: Select all

my $neweq = new Vector($n + 1); # automatically fills with zeroes $neweq->[$l + 1] = 1; $neweq->[$l + $i + 1] = -1;

mjs
Posts: 9
Joined: 15 Mar 2019, 04:15

Re: The root_system function

Postby mjs » 26 Mar 2019, 14:14

Great, thank you for your help!


Return to “Helpdesk”