Ask Your Question

Buddhiang's profile - activity

2020-10-15 14:30:52 +0100 commented answer How to draw a graph in Sage and read GAP file added to the same project

which is similar to the previous one. Will I have to call some package for GAP in Cocalc or in the GAP program I am using?

2020-10-15 14:29:14 +0100 commented answer How to draw a graph in Sage and read GAP file added to the same project

Thanks a lot @slelievre I tried with that and checked. Then I receive the following error..

%run UndirectedGeneratingSetsedited.gap 

---------------------------------------------------------------------------

NameError                                 Traceback (most recent call last)

   /home/user/UndirectedGeneratingSetsedited.gap in <module>()

  7 #        http://hdl.handle.net/10133/4996

  8 

 ----> 9 libgap.eval("""IsIrredundant := function(G,S)

 10         # return true if S is irredundant, which means that no element of S is in

 11         # the subgroup generated by the others

 NameError: name 'libgap' is not define
2020-10-15 09:00:36 +0100 received badge  Scholar (source)
2020-10-15 09:00:35 +0100 received badge  Supporter (source)
2020-10-15 09:00:02 +0100 commented question How to draw a graph in Sage and read GAP file added to the same project

Thank you very much @FrédéricC can I create the plot such that there will be an edge between 1 and 2 points, 1 and 3 points, 2 and 5 points, and so on?

2020-10-15 08:55:51 +0100 commented answer How to draw a graph in Sage and read GAP file added to the same project

Thank you very much @slelievre I am now receiving the error:

%run UndirectedGeneratingSetsedited.gap 

 ---------------------------------------------------------------------------

  NameError                                 Traceback (most recent call last)

  /home/user/UndirectedGeneratingSetsedited.gap in <module>()

  7 #        http://hdl.handle.net/10133/4996

  8 

 ----> 9 gap.eval("""IsIrredundant := function(G,S)

 10         # return true if S is irredundant, which means that no element of S is in

 11         # the subgroup generated by the others

 NameError: name 'gap' is not defined

saying that name gap is not defined. What remedy can be done for it? Thanks a lot in advance.

2020-10-14 01:09:22 +0100 received badge  Student (source)
2020-10-13 07:24:43 +0100 commented question How to draw a graph in Sage and read GAP file added to the same project

Thanks a lot, @slelievre , I edited the question by adding the relevant section of the codes.

2020-10-13 07:23:40 +0100 received badge  Editor (source)
2020-10-12 22:51:31 +0100 asked a question How to draw a graph in Sage and read GAP file added to the same project

I have created a project in CoCalc with the kernel SageMath. There I have opened a new file (New1) and did some computations using the GAP commands, and "gap.eval" before each command enabled me to obtain the results successfully.

Question 1: Next by using some values obtained as a result of the GAP commands, if I need to plot a graph what is the command I will have to use, which will read GAP data successfully? (The output is in the form [[1,2],[1,3],[2,5],...], as an array)

Question 2: I have written another function(Program1) in GAP file and have uploaded it to the same Project. I would like to call this function to the file New1, where I have been working and use it. How can I call it succesfully?

I tried %run Program1.gap , but it didn't work.

The section of the program relevant to Question 2:

When I try to run the .gap file I get the below error, %run UndirectedGeneratingSets.gap

File "/home/user/UndirectedGeneratingSets.gap", line 9
IsIrredundant := function(G,S)
               ^
 SyntaxError: invalid syntax

I added gap.eval command to places where there are commands and updated the .gap file but still I am getting errors as below.

%run UndirectedGeneratingSetsedited.gap  

File "/home/user/UndirectedGeneratingSetsedited.gap", line 12
gap.eval("return ForAll(S, s -> not(s in Subgroup(G, Filtered(S, t -> (t <> s)))));
                                                                                   ^
SyntaxError: EOL while scanning string literal

I don't know why it says as syntax error. I have closed all the brackets in the code as below:

gap.eval("return ForAll(S, s -> not(s in Subgroup(G, Filtered(S, t -> (t <> s)))));
end;")

 gap.eval("IrredGenSetsFromAvailable := function(G, GensRequired, GensAvailable)")
# return a list of the irredundant generating sets of G that contain the set GensRequired
# and are contained in the union of GensRequired and GensAvailable
# (It is assumed that GensRequired is irredundant)
local GenSets, i, S;
gap.eval("GenSets := [];") # GenSets is a list of the generating sets that have been constructed so far
gap.eval("if Subgroup(G, GensRequired) = G then
    # do not add any additional generators
    return [AsSortedList(GensRequired)];
else
    # for each available generator, recursively find all irredundant generating sets
    # that can be obtained by adding it (and perhaps later elements of GensAvailable)
    # to GensRequired
    for i in [1..Length(GensAvailable)] do
        S := Concatenation(GensRequired, [GensAvailable[i]]);
        if IsIrredundant(G,S) then
            Append(GenSets, IrredGenSetsFromAvailable(G, S,
                    GensAvailable{[i+1 .. Length(GensAvailable)]}));
        fi;
    od;
fi;
return GenSets;
 end;")

and similarly for the rest of the codes in that program as well.

Many many thanks in advance.