OreTools
GCD
compute greatest common right or left divisor (GCRD or GCLD) of Ore polynomials
LCM
compute least common left or right multiple (LCLM or LCRM) of Ore polynomials
ExtendedGCD
compute the GCRD or GCLD of two Ore polynomials and the last two members of the first or/and second co-sequences
Calling Sequence
Parameters
Description
Examples
References
GCD['right'](Poly1, Poly2, ..., Polyk, 'cofactors' = true, A)
GCD(Poly1, Poly2, ..., Polyk, 'cofactors' = true, A)
GCD['left'](Poly1, Poly2, ..., Polyk, 'cofactors' = true, A)
LCM['left'](Poly1, Poly2, ..., Polyk, 'cofactors' = true, A)
LCM(Poly1, Poly2, ..., Polyk, 'cofactors' = true, A)
LCM['right'](Poly1, Poly2, ..., Polyk, 'cofactors' = true, A)
ExtendedGCD['right'](Poly1, Poly2, A, 'c1', 'c2')
ExtendedGCD(Poly1, Poly2, A, 'c1', 'c2')
ExtendedGCD['left'](Poly1, Poly2, A, 'c1', 'c2')
Poly1, Poly2, ..., Polyk
-
nonzero Ore polynomials; to define an Ore polynomial, use the OrePoly structure.
'cofactors' = true
(optional) equation; force computation of cofactors
A
Ore algebra; to define an Ore algebra, use the SetOreRing function.
c1, c2
(optional) names.
The GCD['right'](Poly1, Poly2, ..., Polyk, A) or GCD(Poly1, Poly2, ..., Polyk, A) calling sequence returns the monic GCRD of Poly1, Poly2, ..., Polyk. The GCD['left'](Poly1, Poly2, ..., Polyk, A) calling sequence returns the monic GCLD of Poly1, Poly2, ..., Polyk.
If the optional 'cofactors = true' equation is specified, the GCD function returns a list in which the first element is the GCRD (resp. GCLD) of the Ore polynomials and the second element is a list of all the left (resp. right) cofactors of the Ore polynomials and the GCRD (resp. GCLD).
The LCM['left'](Poly1, Poly2, ..., Polyk, A) or LCM(Poly1, Poly2, ..., Polyk, A) calling sequence returns the monic LCLM of Poly1, Poly2, ..., Polyk. The LCM['right'](Poly1, Poly2, ..., Polyk, A) calling sequence returns the monic LCRM of Poly1, Poly2, ..., Polyk.
If the optional 'cofactors = true' equation is specified, the LCM function returns a list in which the first element is the LCLM (resp. LCRM) of the Ore polynomials and the second element is a list of all the left (resp. right) cofactors of the LCLM (resp. LCRM) and the Ore polynomials.
The ExtendedGCD['right'](Poly1, Poly2, A) or ExtendedGCD(Poly1, Poly2, A) calling sequence returns the monic GCRD of Poly1 and Poly2.
The fourth optional argument c1, when present, is assigned a pair [u, v] of Ore polynomials such that (u Poly1 - G) is right divisible by Poly2, where G is the monic GCRD of Poly1 and Poly2; and v Poly1 is the LCLM of Poly1 and Poly2.
The fourth and fifth optional arguments c1 and c2, when present, are assigned two pairs [u1, v1] and [u2, v2] of Ore polynomials, respectively. In this case,
u1⁢Poly1+u2⁢Poly2=G⁢⁢and⁢v1⁢Poly1+v2⁢Poly2=OrePoly⁡0
where G is the monic GCRD of Poly1 and Poly2, v1 Poly1 is the LCLM of Poly1 and Poly2.
The ExtendedGCD['left'](Poly1, Poly2, A) calling sequence returns the monic GCLD of Poly1 and Poly2.
The fourth optional argument c1, when present, is assigned a pair [u, v] of Ore polynomials such that (Poly1 u - G) is left divisible by Poly2, where G is the monic GCLD of Poly1 and Poly2; and Poly1 v is the LCRM of Poly1 and Poly2.
Poly1⁢u1+Poly2⁢u2=G⁢⁢and⁢⁢Poly1⁢v1+Poly2⁢v2=OrePoly⁡0
where G is the monic GCLD of Poly1 and Poly2, Poly1 v1 is the LCRM of Poly1 and Poly2.
with⁡OreTools:
A≔SetOreRing⁡x,differential
A≔UnivariateOreRing⁡x,differential
G≔OrePoly⁡1,3⁢x
Poly1≔Multiply⁡OrePoly⁡1x,0,x2x+2,G,A
Poly1≔OrePoly⁡1x,3,7⁢x2x+2,3⁢x3x+2
Poly2≔Multiply⁡OrePoly⁡x−1,x,G,A
Poly2≔OrePoly⁡x−1,3⁢x2+x,3⁢x2
GCDright⁡Poly1,Poly2,A
OrePoly⁡13⁢x,1
GCD⁡Poly1,G,Poly2,A
GCD⁡Poly1,Poly2,G,cofactors=true,A
OrePoly⁡13⁢x,1,OrePoly⁡3,6⁢x2x+2,3⁢x3x+2,OrePoly⁡3⁢x2,3⁢x2,OrePoly⁡3⁢x
LCM⁡Poly1,Poly2,G,A
OrePoly⁡x5−3⁢x4−7⁢x3+15⁢x2−43⁢x5⁢x3−2⁢x2+x+2,3⁢x5−5⁢x4−21⁢x3+33⁢x2+16⁢x+43⁢x4⁢x3−2⁢x2+x+2,7⁢x5−18⁢x4+7⁢x3+12⁢x2+40⁢x+123⁢x3−2⁢x2+x+2⁢x3,3⁢x4+x3−17⁢x2+19⁢x+323⁢x⁢x3−2⁢x2+x+2,1
H≔ExtendedGCDright⁡Poly1,Poly2,A,c1
H≔OrePoly⁡x3−2⁢x2+x+2x⁢x+2,3⁢x3−2⁢x2+x+2x+2
c1
OrePoly⁡1,OrePoly⁡−x2⁢x4−2⁢x3−7⁢x2+12⁢x+4x3−2⁢x2+x+22,−x2⁢x+2x3−2⁢x2+x+2
Check result.
Remainderright⁡Minus⁡Multiply⁡c11,Poly1,A,H,Poly2,A
OrePoly⁡0
Remainder⁡Multiply⁡c12,Poly1,A,Poly2,A
H≔ExtendedGCD⁡Poly1,Poly2,A,c1,c2
Minus⁡Add⁡Multiply⁡c11,Poly1,A,Multiply⁡c21,Poly2,A,H
Add⁡Multiply⁡c12,Poly1,A,Multiply⁡c22,Poly2,A
A≔SetOreRing⁡n,shift
A≔UnivariateOreRing⁡n,shift
G≔OrePoly⁡1,3⁢n−3
Poly1≔Multiply⁡G,OrePoly⁡1,n,n2,A
Poly1≔OrePoly⁡1,4⁢n−3,4⁢n2−3,3⁢n−1⁢n+12
Poly2≔Multiply⁡G,OrePoly⁡n−1,n,G,A
Poly2≔OrePoly⁡n−1,6⁢n2−8⁢n+3,9⁢n3−3⁢n2−3,9⁢n−1⁢n+12
GCDleft⁡Poly1,Poly2,A
OrePoly⁡13⁢n−2,1
GCDleft⁡Poly1,Poly2,G,cofactors=true,A
OrePoly⁡13⁢n−2,1,OrePoly⁡3⁢n−6,3⁢n2−6⁢n,3⁢n−2⁢n2,OrePoly⁡3⁢n2−9⁢n+6,9⁢n3−33⁢n2+39⁢n−18,9⁢n−2⁢n2,OrePoly⁡3⁢n−6
LCMright⁡Poly1,Poly2,G,A
OrePoly⁡7⁢n3−66⁢n2+176⁢n−1179⁢7⁢n7−171⁢n6+1750⁢n5−9735⁢n4+31813⁢n3−61104⁢n2+63900⁢n−28080,49⁢n5−518⁢n4+1972⁢n3−3307⁢n2+2398⁢n−6489⁢n5−15⁢n4+87⁢n3−245⁢n2+336⁢n−180⁢7⁢n3−38⁢n2+58⁢n−27,2⁢56⁢n5−297⁢n4+430⁢n3−141⁢n2+48⁢n−819⁢n3−8⁢n2+20⁢n−16⁢n⁢7⁢n2−17⁢n+3⁢n−1,105⁢n5−122⁢n4−291⁢n3+260⁢n2+171⁢n−1449⁢n3−5⁢n2+7⁢n−3⁢n⁢7⁢n2−3⁢n−7,21⁢n5+47⁢n4−8⁢n3−70⁢n2+4⁢n+213⁢n−2⁢7⁢n2+11⁢n−3⁢n2,1
H≔ExtendedGCDleft⁡Poly1,Poly2,A,c1
H≔OrePoly⁡13⁢n−2,1
OrePoly⁡9⁢n4−96⁢n3+373⁢n2−633⁢n+4013⁢7⁢n5−94⁢n4+492⁢n3−1259⁢n2+1580⁢n−780,3⁢n2−8⁢n+37⁢n3−45⁢n2+89⁢n−54,OrePoly⁡9⁢n5−111⁢n4+517⁢n3−1129⁢n2+1148⁢n−434⁢3⁢n2−14⁢n+14⁢3⁢n2−20⁢n+3127⁢7⁢n4−80⁢n3+332⁢n2−595⁢n+390⁢7⁢n5−94⁢n4+492⁢n3−1259⁢n2+1580⁢n−780,21⁢n4−212⁢n3+762⁢n2−1165⁢n+648⁢3⁢n2−8⁢n+32⁢3⁢n2−14⁢n+14227⁢7⁢n4−80⁢n3+332⁢n2−595⁢n+390⁢7⁢n2−31⁢n+27⁢7⁢n5−59⁢n4+186⁢n3−277⁢n2+197⁢n−54,3⁢n2−2⁢n−22⁢3⁢n2−8⁢n+329⁢7⁢n2−17⁢n+3⁢n2⁢7⁢n3−45⁢n2+89⁢n−54
Remainderleft⁡Minus⁡Multiply⁡Poly1,c11,A,H,Poly2,A
Remainderleft⁡Multiply⁡Poly1,c12,A,Poly2,A
H≔ExtendedGCDleft⁡Poly1,Poly2,A,c1,c2
Minus⁡Add⁡Multiply⁡Poly1,c11,A,Multiply⁡Poly2,c21,A,H
Add⁡Multiply⁡Poly1,c12,A,Multiply⁡Poly2,c22,A
Abramov, S.A.; Le, H.Q.; and Li, Z. "OreTools: a computer algebra library for univariate Ore polynomial rings." Technical Report CS-2003-12. School of Computer Science, University of Waterloo, 2003.
Li, Z., and Nemes, I. "A modular algorithm for computing greatest common right divisors of Ore polynomials." Proc. of ISSAC'97, pp. 282-289. Edited by W. Kuechlin. ACM Press, 1997.
See Also
OreTools/Euclidean
OreTools/OreAlgebra
OreTools/OrePoly
OreTools[SetOreRing]
Download Help Document