On Wednesday, April 5, 2023 at 5:49:20 PM UTC+8 Hongyi Zhao wrote:
On Wednesday, April 5, 2023 at 5:45:13 PM UTC+8 Hongyi Zhao wrote: On Wednesday, April 5, 2023 at 5:15:05 PM UTC+8 Jan Groenewald wrote: Hi On Wed, 5 Apr 2023 at 10:03, Hongyi Zhao <hongy...@gmail.com> wrote: But other alternatives didn't work either: sage: import sage.interfaces.gap as ggap sage: ggap.gap_cmd="~/.local/bin/gap" sage: ggap.console() --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In [3], line 1 ----> 1 ggap.console() AttributeError: module 'sage.interfaces.gap' has no attribute 'console' Try gap_console instead of console? 0 jan@dinna-latitude:~$sage ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 9.2, Release Date: 2020-10-24 │ │ Using Python 3.9.2. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: import sage.interfaces.gap as ggap sage: *ggap.console()* --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-2-c7b46a1a6ef6> in <module> ----> 1 ggap.console() AttributeError: module 'sage.interfaces.gap' has no attribute 'console' sage: *ggap.gap_console()* ┌───────┐ GAP 4.11.0 of 29-Feb-2020 │ GAP │ https://www.gap-system.org └───────┘ Architecture: x86_64-pc-linux-gnu-default64-kv7 Configuration: gmp 6.2.1, GASMAN, readline Loading the library and packages ... Packages: Alnuth 3.1.2, AtlasRep 2.1.0, AutPGrp 1.10.2, CTblLib 1.3.1, FactInt 1.6.3, GAPDoc 1.6.3, IO 4.7.0, Polycyclic 2.15.1, PrimGrp 3.4.0, SmallGrp 1.4.1, TomLib 1.2.9, TransGrp 2.0.6 Try '??help' for help. See also '?copyright', '?cite' and '?authors' gap> Yep. This way, even the following still works, which is inconsistent with the comments given by Dima previously in this discussion: Dima is correct, as checked below: sage: n = gap(20062006); n 20062006 sage: import sage.interfaces.gap as gap sage: n = gap(20062006); n --------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In [3], line 1 ----> 1 n = gap(Integer(20062006)); n TypeError: 'module' object is not callable Then, I try to do some further testing as follows, but failed: sage: SmallGroup = libgap.SmallGroup sage: g1 = SmallGroup(8,1) sage: g2 = gap.SmallGroup(8,1) ....: sage: g1==g2 --------------------------------------------------------------------------- GAPError Traceback (most recent call last) Cell In [18], line 1 ----> 1 g1==g2 File ~/Public/repo/github.com/sagemath/sage.git/src/sage/structure/element.pyx:1111, in sage.structure.element.Element.__richcmp__() 1109 return (<Element>self)._richcmp_(other, op) 1110 else: -> 1111 return coercion_model.richcmp(self, other, op) 1112 1113 cpdef _richcmp_(left, right, int op): File ~/Public/repo/github.com/sagemath/sage.git/src/sage/structure/coerce.pyx:1973, in sage.structure.coerce.CoercionModel.richcmp() 1971 # Coerce to a common parent 1972 try: -> 1973 x, y = self.canonical_coercion(x, y) 1974 except (TypeError, NotImplementedError): 1975 pass File ~/Public/repo/github.com/sagemath/sage.git/src/sage/structure/coerce.pyx:1315, in sage.structure.coerce.CoercionModel.canonical_coercion() 1313 x_elt = x 1314 if y_map is not None: -> 1315 y_elt = (<Map>y_map)._call_(y) 1316 else: 1317 y_elt = y File ~/Public/repo/github.com/sagemath/sage.git/src/sage/structure/coerce_maps.pyx:161, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_() 159 print(type(C), C) 160 print(type(C._element_constructor), C._element_constructor) --> 161 raise 162 163 cpdef Element _call_with_args(self, x, args=(), kwds={}): File ~/Public/repo/github.com/sagemath/sage.git/src/sage/structure/coerce_maps.pyx:156, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_() 154 cdef Parent C = self._codomain 155 try: --> 156 return C._element_constructor(x) 157 except Exception: 158 if print_warnings: File ~/Public/repo/github.com/sagemath/sage.git/src/sage/libs/gap/libgap.pyx:318, in sage.libs.gap.libgap.Gap._element_constructor_() 316 else: 317 try: --> 318 return x._libgap_() 319 except AttributeError: 320 pass File ~/Public/repo/github.com/sagemath/sage.git/src/sage/structure/sage_object.pyx:731, in sage.structure.sage_object.SageObject._libgap_() 729 def _libgap_(self): 730 from sage.libs.gap.libgap import libgap --> 731 return libgap.eval(self._libgap_init_()) 732 733 def _libgap_init_(self): File ~/Public/repo/github.com/sagemath/sage.git/src/sage/libs/gap/libgap.pyx:404, in sage.libs.gap.libgap.Gap.eval() 402 403 initialize() --> 404 elem = make_any_gap_element(self, gap_eval(gap_command)) 405 406 # If the element is NULL just return None instead File ~/Public/repo/github.com/sagemath/sage.git/src/sage/libs/gap/util.pyx:367, in sage.libs.gap.util.gap_eval() 365 try: 366 GAP_Enter() --> 367 result = GAP_EvalString(cmd) 368 # We can assume that the result object is a GAP PList (plain list) 369 # and we should use functions for PLists directly for now; see GAPError: Error, Variable: 'f1' must have a value OTOH, it seems that either of the following method works: libgap.SmallGroup(8,1) gap.SmallGroup(8,1) So, which is the more recommended usage? Best, Zhao sage: import sage.interfaces.gap as gap sage: gap.gap_cmd="~/.local/bin/gap" sage: gap.gap_console() ....: ┌───────┐ GAP 4.13dev-346-g577dcec built on 2023-03-15 07:28:54+0800 │ GAP │ https://www.gap-system.org └───────┘ Architecture: x86_64-pc-linux-gnu-default64-kv8 Configuration: gmp 6.2.1, GASMAN, readline Loading the library and packages ... Packages: AClib 1.3.2, Alnuth 3.2.1, AtlasRep 2.1.6, AutPGrp 1.11, Browse 1.8.18, CaratInterface 2.3.4, CRISP 1.4.5, Cryst 4.1.25, CrystCat 1.1.10, CrystKit 0.1, CTblLib 1.3.4, curlInterface 2.3.1, FactInt 1.6.3, FGA 1.4.0, Forms 1.2.9, GAPDoc 1.6.6, genss 1.6.8, IO 4.8.0, IRREDSOL 1.4.4, LAGUNA 3.9.5, orb 4.9.0, Polenta 1.3.10, Polycyclic 2.16, PrimGrp 3.4.2, RadiRoot 2.9, recog 1.4.2, ResClasses 4.7.3, SmallGrp 1.5.1, Sophus 1.27, SpinSym 1.5.2, TomLib 1.2.9, TransGrp 3.6.3, utils 0.81 Try '??help' for help. See also '?copyright', '?cite' and '?authors' gap> Regards, Jan -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/0dfb01d1-db72-4b4c-8007-6ae81c5a4aa1n%40googlegroups.com.