Macaulay2 » Documentation
Packages » RandomObjects :: RandomObject
next | previous | forward | backward | up | index | toc

RandomObject -- framework for creation of random objects

Description

RandomObject bundles the necessary functions for the construction of certified random objects parametrized by a unirational moduli space $M$.

RandomObject is a MutableHashTable as ancestor and needs to have the following keys:

* Construction: the method function assigned to this key contains a unirationality construction.

* Certification: the method function assigned to this key checks whether the constructed object fulfills certain conditions.

In the following example we construct plane curves of degree $d$. The Certification checks whether they are irreducible over the coefficient field.

i1 : constructPlaneCurve = method(TypicalValue=>Ideal, Options=>{Certify=>false})

o1 = constructPlaneCurve

o1 : MethodFunctionWithOptions
i2 : constructPlaneCurve(ZZ,PolynomialRing):=opt->(d,R) -> ideal random(R^1,R^{1:-d})

o2 = FunctionClosure[stdio:2:43-2:77]

o2 : FunctionClosure
i3 : certifyPlaneCurve = method(TypicalValue=>Boolean)

o3 = certifyPlaneCurve

o3 : MethodFunction
i4 : certifyPlaneCurve(Ideal,ZZ,PolynomialRing):=(I,d,R)-> #decompose I==1

o4 = FunctionClosure[stdio:4:51-4:68]

o4 : FunctionClosure
i5 : planeCurve = new RandomObject from {
          Construction => constructPlaneCurve,
          Certification => certifyPlaneCurve
          }

o5 = planeCurve

o5 : RandomObject

We construct a curve of degree $2$ as follows

i6 : setRandomSeed("alpha");
i7 : R=ZZ/3[x_0..x_2];
i8 : (random planeCurve)(2,R)

              2
o8 = ideal(- x  - x x  + x x  - x x )
              0    0 1    0 2    1 2

o8 : Ideal of R

We can certify the curve by using the option Certify

i9 : (random planeCurve)(2,R,Certify=>true)

              2    2           2
o9 = ideal(- x  + x  + x x  + x )
              0    1    0 2    2

o9 : Ideal of R

We have chosen a small finite field as ground field. Hence, there is a certain chance that the curve is not irreducible. We can check this if we limit the number of attempts to $1$. If the curve is then reducible, null is returned.

i10 : tally apply(3^4,i->(random planeCurve)(2,R,Certify=>true,Attempts=>1) === null)

o10 = Tally{false => 66}
            true => 15

o10 : Tally

Methods that use an object of class RandomObject :

For the programmer

The object RandomObject is a type, with ancestor classes MutableHashTable < HashTable < Thing.