/usr/share/axiom-20170501/src/algebra/OREPCAT.spad is in axiom-source 20170501-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | )abbrev category OREPCAT UnivariateSkewPolynomialCategory
++ Author: Manuel Bronstein, Jean Della Dora, Stephen M. Watt
++ Date Created: 19 October 1993
++ Date Last Updated: 1 February 1994
++ References:
++ Bron95 On radical solutions of linear ordinary differential equations
++ Abra01 On Solutions of Linear Functional Systems
++ Muld95 Primitives: Orepoly and Lodo
++ Description:
++ This is the category of univariate skew polynomials over an Ore
++ coefficient ring.
++ The multiplication is given by \spad{x a = \sigma(a) x + \delta a}.
++ This category is an evolution of the types
++ MonogenicLinearOperator, OppositeMonogenicLinearOperator, and
++ NonCommutativeOperatorDivision
UnivariateSkewPolynomialCategory(R) : Category == SIG where
R : Ring
SIG ==> Join(Ring, BiModule(R, R), FullyRetractableTo R) with
degree : $ -> NonNegativeInteger
++ degree(l) is \spad{n} if
++ \spad{l = sum(monomial(a(i),i), i = 0..n)}.
minimumDegree : $ -> NonNegativeInteger
++ minimumDegree(l) is the smallest \spad{k} such that
++ \spad{a(k) ^= 0} if
++ \spad{l = sum(monomial(a(i),i), i = 0..n)}.
leadingCoefficient : $ -> R
++ leadingCoefficient(l) is \spad{a(n)} if
++ \spad{l = sum(monomial(a(i),i), i = 0..n)}.
reductum : $ -> $
++ reductum(l) is \spad{l - monomial(a(n),n)} if
++ \spad{l = sum(monomial(a(i),i), i = 0..n)}.
coefficient : ($, NonNegativeInteger) -> R
++ coefficient(l,k) is \spad{a(k)} if
++ \spad{l = sum(monomial(a(i),i), i = 0..n)}.
monomial : (R, NonNegativeInteger) -> $
++ monomial(c,k) produces c times the k-th power of
++ the generating operator, \spad{monomial(1,1)}.
coefficients : % -> List R
++ coefficients(l) returns the list of all the nonzero
++ coefficients of l.
apply : (%, R, R) -> R
++ apply(p, c, m) returns \spad{p(m)} where the action is
++ given by \spad{x m = c sigma(m) + delta(m)}.
if R has CommutativeRing then Algebra R
if R has IntegralDomain then
"exquo" : (%, R) -> Union(%, "failed")
++ exquo(l, a) returns the exact quotient of l by a,
++ returning \axiom{"failed"} if this is not possible.
monicLeftDivide : (%, %) -> Record(quotient: %, remainder: %)
++ monicLeftDivide(a,b) returns the pair \spad{[q,r]} such that
++ \spad{a = b*q + r} and the degree of \spad{r} is
++ less than the degree of \spad{b}.
++ \spad{b} must be monic.
++ This process is called ``left division''.
monicRightDivide : (%, %) -> Record(quotient: %, remainder: %)
++ monicRightDivide(a,b) returns the pair \spad{[q,r]} such that
++ \spad{a = q*b + r} and the degree of \spad{r} is
++ less than the degree of \spad{b}.
++ \spad{b} must be monic.
++ This process is called ``right division''.
if R has GcdDomain then
content : % -> R
++ content(l) returns the gcd of all the coefficients of l.
primitivePart : % -> %
++ primitivePart(l) returns l0 such that \spad{l = a * l0}
++ for some a in R, and \spad{content(l0) = 1}.
if R has Field then
leftDivide : (%, %) -> Record(quotient: %, remainder: %)
++ leftDivide(a,b) returns the pair \spad{[q,r]} such that
++ \spad{a = b*q + r} and the degree of \spad{r} is
++ less than the degree of \spad{b}.
++ This process is called ``left division''.
leftQuotient : (%, %) -> %
++ leftQuotient(a,b) computes the pair \spad{[q,r]} such that
++ \spad{a = b*q + r} and the degree of \spad{r} is
++ less than the degree of \spad{b}.
++ The value \spad{q} is returned.
leftRemainder : (%, %) -> %
++ leftRemainder(a,b) computes the pair \spad{[q,r]} such that
++ \spad{a = b*q + r} and the degree of \spad{r} is
++ less than the degree of \spad{b}.
++ The value \spad{r} is returned.
leftExactQuotient : (%, %) -> Union(%, "failed")
++ leftExactQuotient(a,b) computes the value \spad{q}, if it exists,
++ such that \spad{a = b*q}.
leftGcd : (%, %) -> %
++ leftGcd(a,b) computes the value \spad{g} of highest degree
++ such that
++ \spad{a = g*aa}
++ \spad{b = g*bb}
++ for some values \spad{aa} and \spad{bb}.
++ The value \spad{g} is computed using left-division.
leftExtendedGcd : (%, %) -> Record(coef1:%, coef2:%, generator:%)
++ leftExtendedGcd(a,b) returns \spad{[c,d]} such that
++ \spad{g = a * c + b * d = leftGcd(a, b)}.
rightLcm : (%, %) -> %
++ rightLcm(a,b) computes the value \spad{m} of lowest degree
++ such that \spad{m = a*aa = b*bb} for some values
++ \spad{aa} and \spad{bb}. The value \spad{m} is
++ computed using left-division.
rightDivide : (%, %) -> Record(quotient: %, remainder: %)
++ rightDivide(a,b) returns the pair \spad{[q,r]} such that
++ \spad{a = q*b + r} and the degree of \spad{r} is
++ less than the degree of \spad{b}.
++ This process is called ``right division''.
rightQuotient : (%, %) -> %
++ rightQuotient(a,b) computes the pair \spad{[q,r]} such that
++ \spad{a = q*b + r} and the degree of \spad{r} is
++ less than the degree of \spad{b}.
++ The value \spad{q} is returned.
rightRemainder : (%, %) -> %
++ rightRemainder(a,b) computes the pair \spad{[q,r]} such that
++ \spad{a = q*b + r} and the degree of \spad{r} is
++ less than the degree of \spad{b}.
++ The value \spad{r} is returned.
rightExactQuotient : (%, %) -> Union(%, "failed")
++ rightExactQuotient(a,b) computes the value \spad{q}, if it exists
++ such that \spad{a = q*b}.
rightGcd : (%, %) -> %
++ rightGcd(a,b) computes the value \spad{g} of highest degree
++ such that
++ \spad{a = aa*g}
++ \spad{b = bb*g}
++ for some values \spad{aa} and \spad{bb}.
++ The value \spad{g} is computed using right-division.
rightExtendedGcd : (%, %) -> Record(coef1:%, coef2:%, generator:%)
++ rightExtendedGcd(a,b) returns \spad{[c,d]} such that
++ \spad{g = c * a + d * b = rightGcd(a, b)}.
leftLcm : (%, %) -> %
++ leftLcm(a,b) computes the value \spad{m} of lowest degree
++ such that \spad{m = aa*a = bb*b} for some values
++ \spad{aa} and \spad{bb}. The value \spad{m} is
++ computed using right-division.
add
coerce(x:R):% == monomial(x, 0)
coefficients l ==
ans:List(R) := empty()
while l ^= 0 repeat
ans := concat(leadingCoefficient l, ans)
l := reductum l
ans
a:R * y:% ==
z:% := 0
while y ^= 0 repeat
z := z + monomial(a * leadingCoefficient y, degree y)
y := reductum y
z
retractIfCan(x:%):Union(R, "failed") ==
zero? x or zero? degree x => leadingCoefficient x
"failed"
if R has IntegralDomain then
l exquo a ==
ans:% := 0
while l ^= 0 repeat
(u := (leadingCoefficient(l) exquo a)) case "failed" =>
return "failed"
ans := ans + monomial(u::R, degree l)
l := reductum l
ans
if R has GcdDomain then
content l == gcd coefficients l
primitivePart l == (l exquo content l)::%
if R has Field then
leftEEA: (%, %) -> Record(gcd:%, coef1:%, coef2:%, lcm:%)
rightEEA: (%, %) -> Record(gcd:%, coef1:%, coef2:%, lcm:%)
ncgcd: (%, %, (%, %) -> %) -> %
nclcm: (%, %, (%, %) -> Record(gcd:%, coef1:%, coef2:%, lcm:%)) -> %
exactQuotient: Record(quotient:%, remainder:%) -> Union(%, "failed")
extended: (%, %, (%, %) -> Record(gcd:%, coef1:%, coef2:%, lcm:%)) ->
Record(coef1:%, coef2:%, generator:%)
leftQuotient(a, b) == leftDivide(a,b).quotient
leftRemainder(a, b) == leftDivide(a,b).remainder
leftExtendedGcd(a, b) == extended(a, b, leftEEA)
rightLcm(a, b) == nclcm(a, b, leftEEA)
rightQuotient(a, b) == rightDivide(a,b).quotient
rightRemainder(a, b) == rightDivide(a,b).remainder
rightExtendedGcd(a, b) == extended(a, b, rightEEA)
leftLcm(a, b) == nclcm(a, b, rightEEA)
leftExactQuotient(a, b) == exactQuotient leftDivide(a, b)
rightExactQuotient(a, b) == exactQuotient rightDivide(a, b)
rightGcd(a, b) == ncgcd(a, b, rightRemainder)
leftGcd(a, b) == ncgcd(a, b, leftRemainder)
exactQuotient qr == (zero?(qr.remainder) => qr.quotient; "failed")
-- returns [g = leftGcd(a, b), c, d, l = rightLcm(a, b)]
-- such that g := a c + b d
leftEEA(a, b) ==
a0 := a
u0:% := v:% := 1
v0:% := u:% := 0
while b ^= 0 repeat
qr := leftDivide(a, b)
(a, b) := (b, qr.remainder)
(u0, u):= (u, u0 - u * qr.quotient)
(v0, v):= (v, v0 - v * qr.quotient)
[a, u0, v0, a0 * u]
ncgcd(a, b, ncrem) ==
zero? a => b
zero? b => a
degree a < degree b => ncgcd(b, a, ncrem)
while b ^= 0 repeat (a, b) := (b, ncrem(a, b))
a
extended(a, b, eea) ==
zero? a => [0, 1, b]
zero? b => [1, 0, a]
degree a < degree b =>
rec := eea(b, a)
[rec.coef2, rec.coef1, rec.gcd]
rec := eea(a, b)
[rec.coef1, rec.coef2, rec.gcd]
nclcm(a, b, eea) ==
zero? a or zero? b => 0
degree a < degree b => nclcm(b, a, eea)
rec := eea(a, b)
rec.lcm
-- returns [g = rightGcd(a, b), c, d, l = leftLcm(a, b)]
-- such that g := a c + b d
rightEEA(a, b) ==
a0 := a
u0:% := v:% := 1
v0:% := u:% := 0
while b ^= 0 repeat
qr := rightDivide(a, b)
(a, b) := (b, qr.remainder)
(u0, u):= (u, u0 - qr.quotient * u)
(v0, v):= (v, v0 - qr.quotient * v)
[a, u0, v0, u * a0]
|