[next][previous][up][top][index]
search for:

using functions with optional arguments

Some functions accept optional arguments. Each of these optional arguments has a name. For example, one of the optional arguments for gb is named DegreeLimit; it can be used to specify that the computation should stop after a certain degree has been reached. Values for optional arguments are specified by providing additional arguments of the form B=>v where B is the name of the optional argument, and v is the value provided for it.

i1 : R = ZZ/101[x,y,z,w];
i2 : gb ideal(x*y-z^2,y^2-w^2)

o2 = | y2-w2 xy-z2 yz2-xw2 z4-x2w2 |

o2 : GroebnerBasis
i3 : gb(ideal(x*y-z^2,y^2-w^2),DegreeLimit => 2)

o3 = | y2-w2 xy-z2 |

o3 : GroebnerBasis

The names and default values of the optional arguments for a function can be obtained with options, as follows.

i4 : o = options res

o4 = OptionTable{DegreeLimit =>                }
                 HardDegreeLimit => {}
                 LengthLimit => infinity
                 PairLimit => infinity
                 SortStrategy => 0
                 StopBeforeComputation => false
                 Strategy => 
                 SyzygyLimit => infinity

o4 : OptionTable

The value returned is a type of hash table, and can be used to obtain particular default values.

i5 : o.SortStrategy

o5 = 0

The entry DegreeLimit => 2 is called an option. Internally it is represented as a type of list of length 2.

i6 : DegreeLimit => 2

o6 = DegreeLimit => 2

o6 : Option
i7 : peek oo

o7 = Option{DegreeLimit,2}


[next][previous][up][top][index]
search for: