From 236a2ae0dd2abb3634f3f517dc78e15335aa7643 Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Wed, 27 Nov 2024 12:16:49 -0500 Subject: [PATCH] Improve gcdCoefficients docs Convert to SimpleDoc, add new methods, and provide examples --- .../packages/Macaulay2Doc/doc_arithmetic.m2 | 44 +++++++++++++++---- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/M2/Macaulay2/packages/Macaulay2Doc/doc_arithmetic.m2 b/M2/Macaulay2/packages/Macaulay2Doc/doc_arithmetic.m2 index 3ef74852aa..2ffe60fe7d 100644 --- a/M2/Macaulay2/packages/Macaulay2Doc/doc_arithmetic.m2 +++ b/M2/Macaulay2/packages/Macaulay2Doc/doc_arithmetic.m2 @@ -72,15 +72,41 @@ document { "conjugate 3" } } -document { - Key => {gcdCoefficients,(gcdCoefficients, RingElement, RingElement),(gcdCoefficients, ZZ, ZZ)}, - Headline => "gcd with coefficients", - TT "gcdCoefficients(a,b)", " -- returns ", TT "{d,r,s}", " so that - ", TT"a*r + b*s", " is the greatest common divisor ", TT "d", " of ", TT "a", " - and ", TT "b", ".", - PARA{}, - "Works for integers or elements of polynomial rings in onve variable.", - SeeAlso => "gcd"} + +doc /// + Key + gcdCoefficients + (gcdCoefficients, RingElement, RingElement) + (gcdCoefficients, RingElement, ZZ) + (gcdCoefficients, ZZ, RingElement) + (gcdCoefficients, ZZ, ZZ) + Headline + greatest common divisor with coefficients + Usage + gcdCoefficients(a, b) + Inputs + a:{RingElement, ZZ} + b:{RingElement, ZZ} + Description + Text + This returns a list of the form @CODE "{d, r, s}"@ so that $d = ar + bs$ + and $d=\gcd(a, b)$. + + It works for integers or elements of polynomial rings in one variable. + Example + gcdCoefficients(46, 240) + gcd(46, 240) + 46 * 47 + 240 * (-9) + R = ZZ/2[x] + f = x^8 + x^4 + x^3 + x + 1 + g = x^6 + x^4 + x + 1 + gcdCoefficients(f, g) + gcd(f, g) + f * (x^5 + x^4 + x^3 + x^2 + 1) + g * (x^7 + x^6 + x^3 + x) + SeeAlso + gcd +/// + document { Key => mod, Headline => "reduce modulo an integer",