Programming the Euclidean algorithm for arbitrary Euclidean Domains in Maple

125 Views Asked by At

I have to implement the Euclidean algorithm for arbitrary domains in Maple.

I know how to do this for integers:

GCD:=proc(a,b) description "Computes the GCD of two integers";
    local r_0, r_1, aux;
    r_0 := a; r_1 := b;
    while r_1<>0 do;
        aux := irem(r_0, r_1);
        r_0 := r_1; r_1 := aux;
    od;
    return r_0;
    end proc:

But how do I represent elements from arbitrary domains in Maple? And how do I operate with them?

1

There are 1 best solutions below

0
On

You will have to learn how to use Maple's object oriented programming interface. You can define a class whose instances will be Euclidean Domains and use methods from that class on objects of that class.

I don't know Maple. If there is a class for Rings already you will be able to build on that.

https://www.maplesoft.com/support/help/maple/view.aspx?path=object