---------------------------------------------------------------------- -- Anna Bigatti: CoCoA tutorial in Linz semester 2006 ---------------------------------------------------------------------- Unset Indentation; ---------------------------------------------------------------------- -- 2 -- CoCoA-4 in action: (exact) ideal of points Use R ::= Q[x,y]; Pts := [ [1/N, (1/N)^2] | N In 2..7 ]; Pts; Set Indentation; IdealOfPoints(Pts); X := IdealAndSeparatorsOfPoints(Pts); S := X.Separators; Foreach P In Pts Do Print Eval(S[2], P), " "; EndForeach; F := Interpolate(Pts, [10, 1, 4, 5, 1/7, 1/4]); F; Foreach P In Pts Do Print Eval(F, P), " "; EndForeach; ---------------------------------------------------------------------- -- approximate the original points: Unset Indentation; Use R; ApproxPts := [ [FloatApprox(P[1],10^(-9)),FloatApprox(P[2],10^(-9))] | P In Pts]; ApproxPts; LT(IdealOfPoints(Pts)); LT(IdealOfPoints(ApproxPts)); LT(IdealOfPoints(GenericPoints(Len(Pts)))); ---------------------------------------------------------------------- -- the implementation is very efficient (modular algorithm) Use Q[x[1..10]]; RandomPts := [ [ Rand(-10,10) | I In 1..NumIndets()] | N In 1..20 ]; Time I := IdealOfPoints(RandomPts); I; -- but the answer is very big: -- "your memory runs out before your patience does" ---------------------------------------------------------------------- -- 3 -- CoCoA-4 & CoCoAServer: a step into the future Use Q[x[0..4]]; RandomPolys := [ Randomized(DensePoly(3)) | N In 1..4 ]; RandomPolys; -- LT(Ideal(RandomPolys)); -- 30 min (60 min using battery) -- X := LT5(Ideal(RandomPolys)); -- 1 min (2 min Using battery) Y := LT5x(Ideal(RandomPolys), Record[FloatPrecision = 128]); Y := GBasis5x(Ideal(RandomPolys), Record[FloatPrecision = 128]); -- what happens if the precision is not enough? Z := LT5x(Ideal(RandomPolys), Record[FloatPrecision = 32]); -- And more: multigradings, parameters, ... ---------------------------------------------------------------------- -- 4 -- CoCoALib: the full experience [John Abbott]