Euclid's algorithm for polynomials on MAGMA

148 Views Asked by At

I have to compute the GCD between two polynomials on MAGMA. I do not have any problem with the Euclidean Algorithm but I have a problem with the function "mod" that, as they say on the MAGMA Handbook, given two polynomials f and g should give the remainder of the division between f and g. It doesn't work.

For example, using f(x)=x^2 and g(x)=x it returns "Runtime error in 'mod': Bad argument types Argument types given: RngMPolElt, RngMPolElt".

Any help?

Thank you.

1

There are 1 best solutions below

1
On BEST ANSWER

It works for me. Try pasting the following code into the online Magma calculator and pressing "submit".

P<x> := PolynomialRing(Rationals());
f:=x^2;
g:=x;
print f mod g;

Note the first line of the code. Before you can do anything with polynomials in an indeterminate $\ x\ $ in Magma, you have to tell it that "$x$" is a symbol representing the indeterminate of some polynomial ring, which is what the command in the first line of the above code does.