mod and rem in Maple

$\begingroup$

I do not understand this statement "reduce the coefficient modulo 5 and take remainder"?

Is the following Maple command to reduce the coefficient modulo 5 , which coefficient to reduce?

rem(6*x^2*y-5*x^2-x*y^3+7*y^2+13, pmod(6*x^2*y-5*x^2-x*y^3+7*y^2+13,5));

And why use 5 and 7 ? where do these integer come from?

I find a statement divide each coefficient by $q$ and take the remainder but type command according to this statement is not correct

rem(6*x^2*y-5*x^2-x*y^3+7*y^2+13, quo(6*x^2*y-5*x^2-x*y^3+7*y^2+13, 5));

The following two also not equal x^2y-xy^3+2y^2-2

rem(pmod(6*x^2*y-5*x^2-x*y^3+7*y^2+13, 5), 6*x^2*y-5*x^2-x*y^3+7*y^2+13)
rem(6*x^2*y-5*x^2-x*y^3+7*y^2+13, pmod(6*x^2*y-5*x^2-x*y^3+7*y^2+13, 5))/5

What is the difference between mod and rem in Maple? Aren't they both remainder?

$\endgroup$ 1

1 Answer

$\begingroup$

I assume you meant modp (which is one variant of the mod operator in Maple) instead of pmod (which does not exist in my version of Maple, or in the MapleSoft online help system).

The difference between rem and mod is that rem does polynomial division, while mod simply does ordinary integer division on the coefficients. For example:

p := expand( (x-1)*(x+9)*(x^2-23) );

$$p := x^4 - 32 x^2 + 8 x^3 - 184 x + 207 $$

p mod 10;

$$x^4 + 8 x^2 + 8 x^3 + 6 x + 7 $$

rem(p, x-1, x); # x-1 is a factor of p

$$0$$

r := rem(p, x^3-1, x);

$$r := 215 - 32 x^2 - 183 x$$

q := quo(p, x^3-1, x);

$$q := x + 8$$

expand(q * (x^3-1) + r); # reconstruct p from q and r

$$x^4 - 32 x^2 + 8 x^3 - 184 x + 207$$

$\endgroup$ 2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like