Message Boards Message Boards

0
|
3396 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Is PolynomialExtendedGCD working properly?

Posted 8 years ago

I have the following Mathematica code:

a = x^3 + x^2 + 4 x + 4;
b = 3 x^4 + x^2 + 1;
d = PolynomialGCD[a, b, x, Modulus -> 5];
Print["d=", d]
{d1, {s, t}} = PolynomialExtendedGCD[a, b, x, Modulus -> 5];
Print["d1=", d1]

which gives the following output:

d=1
d1=4+x^2

The correct answer is $1$ indeed. So is PolynomialExtendedGCD working incorrect?

P.S. I am using Mathematica 11.0.0.0 on Ubuntu.

POSTED BY: Yauhen Yakimenka
2 Replies

Both results shown are correct; the use of PolynomialGCD is not quite what was intended. In particular, PolynomialGCD does not take a variable as an argument because a polynomial gcd is a multivariate entity. The extended gcd relies on having a single variable, with everything else being in a coefficient field (typically the rationals or integers modulo a prime, but could instead be a function field).

a = x^3 + x^2 + 4 x + 4;
b = 3 x^4 + x^2 + 1;
d = PolynomialGCD[a, b, Modulus -> 5]

(* Out[3]= 4 + x^2 *)
POSTED BY: Daniel Lichtblau

Great, thanks! Now I see my mistake.

POSTED BY: Yauhen Yakimenka
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract