I am trying to write a function which would create an s polynomial when provided with two polynomials : p1 and p2.

Here it is :

sPolynomial := function(p1, p2, order)
    local lcm, res;

    lcm := Lcm(LeadingMonomialOfPolynomial(p1, order), LeadingMonomialOfPolynomial(p1, order));
    res := (lcm*p1)/LeadingTermOfPolynomial(p1,order) - (lcm*p2)/LeadingTermOfPolynomial(p2,order);

    return res;


Then here is what I am trying to do:

gap> x := Indeterminate(FLOAT_PSEUDOFIELD,"x");
gap> y := Indeterminate(FLOAT_PSEUDOFIELD, "y");
gap> l:=[x^3-2*x*y,(x^2)*y-2*y^2+x,-x^2,-2*x*y,-2*y^2+x];
gap> lexord:=MonomialLexOrdering();
gap> Read("SPolynomial.txt");
gap> sPolynomial(l[4], l[5], lexord);
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
Error, no 1st choice method found for `IsFiniteDimensional' on 1 arguments at /proc/cygdrive/C/gap-4.9.1/lib/methsel2.g:250 called from
IsFiniteDimensional( V ) at /proc/cygdrive/C/gap-4.9.1/lib/modfree.gi:120 called from
IsFinite( r ) at /proc/cygdrive/C/gap-4.9.1/lib/ringpoly.gi:172 called from
PolynomialRing( DefaultField( cfs ), ind ) at /proc/cygdrive/C/gap-4.9.1/lib/ringpoly.gi:579 called from
DefaultRingByGenerators( arg[1] ) at /proc/cygdrive/C/gap-4.9.1/lib/ring.gi:396 called from
DefaultRing( arg ) at /proc/cygdrive/C/gap-4.9.1/lib/ring.gi:1373 called from
...  at *stdin*:19
you can 'quit;' to quit to outer loop, or
you can 'return;' to continue
brk> quit;

How could it be that the method was not found? I checked that it is situated in the needed directory.

What am I doing wrong in the case? Will be grateful for any help provided.

  • $\begingroup$ "No method found" is not the same as "No file found", so the directory is not relevant here. Instead, it's a special kind of message informing you that there is no method installed - in this case for IsFiniteDimensional for V. It could be anything from calling a function with an argument of a wrong type to more complicated reasons. Please see here for some ways to inspect what's happening. I have tried to reproduce the example myself, but can't do so without definitions for indeterminates x and y. $\endgroup$ – Alexander Konovalov Jun 3 '18 at 21:34
  • 1
    $\begingroup$ You are using undocumented FLOAT_PSEUDOFIELD. The code works if you define indeterminates via x := Indeterminate(Rationals,"x"); and y := Indeterminate(Rationals,"y");. Why FLOAT_PSEUDOFIELD is necessary for your calculation? $\endgroup$ – Alexander Konovalov Jun 4 '18 at 19:35
  • $\begingroup$ @AlexanderKonovalov, but I would like to use Real numbers. $\endgroup$ – manymanymore Jun 4 '18 at 19:44
  • $\begingroup$ Ok, actually it's mentioned in the Float package but as said there, such polynomials "behave, in subtle ways, quite differently than polynomials over rings". It might happen that you will have to go back and forth between polynomials over FLOAT_PSEUDOFIELD and over Rationals, using the latter when exact computations suffice. $\endgroup$ – Alexander Konovalov Jun 4 '18 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.