2is regarded as a 64 bit integer. Write
ZZRingElem(2)^100to get a long.
TODO: add more hints of this kind
This section describes differences between GAP and Oscar. (Hints about using GAP in Oscar can be found in the section about GAP Integration.)
The syntax of the languages is slightly different.
In GAP, equality of two objects is checked with
=, and one assigns a value to a variable with
:=. In Julia, equality is checked with
=denotes assignment. Similarly, inequality of objects is checked with
<>in GAP and with
In GAP, the operator
notis used to negate boolean expressions, whereas
!is used in Julia.
In GAP, object identity is checked with the function
IsIdenticalObj, whereas the infix operator
!==) is used in Julia.
ifstatements have the form
if condition1 then statements1 elif condition2 then statements2 else statements3 fi;
whereas the Julia syntax is
if condition1 statements1 elseif condition2 statements2 else statements3 end
forloops have the form
for var in list do statements od;
whereas the Julia syntax is
for var in list statements end
(The situation with
whileloops is analogous.)
Variable names in GAP and Julia are recommended to be written in camel case and snake case, respectively, see Naming conventions. For example, the GAP function
SylowSubgroupcorresponds to Oscar's
Thus the GAP rule that the names of user variables should start with a lowercase letter, in order to avoid clashes with system variables, does not make sense in Julia.
Moreover, global Oscar variables are not write protected, contrary to most global GAP variables. Thus there is always the danger that assignments overwrite Julia functions. For example, it is tempting to use
mapas names for variables, but Julia or Oscar define them already.
(Also copying some lines of code from an Oscar function into a Julia session can be dangerous in this sense, because some names of local variables of the function may coincide with the names of global variables.)
GAP provides natural embeddings of many algebraic structures. For example, two finite fields of the same characteristic are embedded into each other whenever this makes sense, and the elements of the smaller field are regarded also as elements of the larger field. Analogously, subfields of cyclotomic fields are naturally embedded into each other, and in fact their elements are internally represented w.r.t. the smallest possible cyclotomic field.
In Oscar, this is not the case. Each element of an algebraic structure has a parent, and operations involving several elements (such as arithmetic operations) are usually restricted to the situation that their parents coincide. One has to explicitly coerce a given element into a different parent if necessary.
The consequences can be quite subtle. Each permutation group in Oscar has a fixed degree, and the function
is_transitivechecks whether its argument is transitive on the points from 1 to the degree. In GAP, however, the function
IsTransitive, called with a permutation group, checks whether this group is transitive on the points which are moved by it. Thus the group generated by the permutation
(1, 2, 4)is regarded as transitive in GAP but as intransitive in Oscar.
- TODO: also talk about how to use it from OSCAR?
OSCAR (and Julia) is
1-based, meaning that it counts from
1, rather than from
0like polymake. For most properties we have taken care of the translation but be aware that it might pop up at some point and generate confusion.
Polyhedra and polyhedral complexes in OSCAR are represented inhomogeneously, i.e. without the leading
1for vertices or
0for rays. Hence constructors take points, rays, and lineality generators separately.
user_methods cannot be accessed via Julia's dot syntax, i.e. something like
c = Polymake.polytope.cube(3) c.AMBIENT_DIM
will not work. Instead
user_methods are attached as Julia functions in their respective application. They are always written in lowercase. In the example the following works:
c = Polymake.polytope.cube(3) Polymake.polytope.ambient_dim(c)