/usr/share/axiom-20170501/src/algebra/DPOLCAT.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 | )abbrev category DPOLCAT DifferentialPolynomialCategory
++ Author: William Sit
++ Date Created: 19 July 1990
++ Date Last Updated: 13 September 1991
++ References:Kolchin, E.R. "Differential Algebra and Algebraic Groups"
++ (Academic Press, 1973).
++ Description:
++ \spadtype{DifferentialPolynomialCategory} is a category constructor
++ specifying basic functions in an ordinary differential polynomial
++ ring with a given ordered set of differential indeterminates.
++ In addition, it implements defaults for the basic functions.
++ The functions \spadfun{order} and \spadfun{weight} are extended
++ from the set of derivatives of differential indeterminates
++ to the set of differential polynomials. Other operations
++ provided on differential polynomials are
++ \spadfun{leader}, \spadfun{initial},
++ \spadfun{separant}, \spadfun{differentialVariables}, and
++ \spadfun{isobaric?}. Furthermore, if the ground ring is
++ a differential ring, then evaluation (substitution
++ of differential indeterminates by elements of the ground ring
++ or by differential polynomials) is
++ provided by \spadfun{eval}.
++ A convenient way of referencing derivatives is provided by
++ the functions \spadfun{makeVariable}.
++
++ To construct a domain using this constructor, one needs
++ to provide a ground ring R, an ordered set S of differential
++ indeterminates, a ranking V on the set of derivatives
++ of the differential indeterminates, and a set E of
++ exponents in bijection with the set of differential monomials
++ in the given differential indeterminates.
DifferentialPolynomialCategory(R,S,V,E) : Category == SIG where
R : Ring
S : OrderedSet
V : DifferentialVariableCategory(S)
E : OrderedAbelianMonoidSup
PC ==> PolynomialCategory(R,E,V)
DE ==> DifferentialExtension(R)
RT ==> RetractableTo(S)
SIG ==> Join(PC,DE,RT) with
-- Examples:
-- s:=makeVariable('s)
-- p:= 3*(s 1)**2 + s*(s 2)**3
-- all functions below have default implementations
-- using primitives from V
makeVariable : S -> (NonNegativeInteger -> $)
++ makeVariable(s) views s as a differential
++ indeterminate, in such a way that the n-th
++ derivative of s may be simply referenced as z.n
++ where z :=makeVariable(s).
++ Note that In the interpreter, z is
++ given as an internal map, which may be ignored.
-- Example: makeVariable('s); %.5
differentialVariables : $ -> List S
++ differentialVariables(p) returns a list of differential
++ indeterminates occurring in a differential polynomial p.
order : ($, S) -> NonNegativeInteger
++ order(p,s) returns the order of the differential
++ polynomial p in differential indeterminate s.
order : $ -> NonNegativeInteger
++ order(p) returns the order of the differential polynomial p,
++ which is the maximum number of differentiations of a
++ differential indeterminate, among all those appearing in p.
degree : ($, S) -> NonNegativeInteger
++ degree(p, s) returns the maximum degree of
++ the differential polynomial p viewed as a differential polynomial
++ in the differential indeterminate s alone.
weights : $ -> List NonNegativeInteger
++ weights(p) returns a list of weights of differential monomials
++ appearing in differential polynomial p.
weight : $ -> NonNegativeInteger
++ weight(p) returns the maximum weight of all differential monomials
++ appearing in the differential polynomial p.
weights : ($, S) -> List NonNegativeInteger
++ weights(p, s) returns a list of
++ weights of differential monomials
++ appearing in the differential polynomial p when p is viewed
++ as a differential polynomial in the differential indeterminate s
++ alone.
weight : ($, S) -> NonNegativeInteger
++ weight(p, s) returns the maximum weight of all differential
++ monomials appearing in the differential polynomial p
++ when p is viewed as a differential polynomial in
++ the differential indeterminate s alone.
isobaric? : $ -> Boolean
++ isobaric?(p) returns true if every differential monomial appearing
++ in the differential polynomial p has same weight,
++ and returns false otherwise.
leader : $ -> V
++ leader(p) returns the derivative of the highest rank
++ appearing in the differential polynomial p
++ Note that an error occurs if p is in the ground ring.
initial : $ -> $
++ initial(p) returns the
++ leading coefficient when the differential polynomial p
++ is written as a univariate polynomial in its leader.
separant : $ -> $
++ separant(p) returns the
++ partial derivative of the differential polynomial p
++ with respect to its leader.
if R has DifferentialRing then
InnerEvalable(S, R)
InnerEvalable(S, $)
Evalable $
makeVariable : $ -> (NonNegativeInteger -> $)
++ makeVariable(p) views p as an element of a differential
++ ring, in such a way that the n-th
++ derivative of p may be simply referenced as z.n
++ where z := makeVariable(p).
++ Note that In the interpreter, z is
++ given as an internal map, which may be ignored.
-- Example: makeVariable(p); %.5; makeVariable(%**2); %.2
add
p:$
s:S
makeVariable s == n +-> makeVariable(s,n)::$
if R has IntegralDomain then
differentiate(p:$, d:R -> R) ==
ans:$ := 0
l := variables p
while (u:=retractIfCan(p)@Union(R, "failed")) case "failed" repeat
t := leadingMonomial p
lc := leadingCoefficient t
ans := ans + d(lc)::$ * (t exquo lc)::$
+ +/[differentiate(t, v) * (differentiate v)::$ for v in l]
p := reductum p
ans + d(u::R)::$
order (p:$):NonNegativeInteger ==
ground? p => 0
"max"/[order v for v in variables p]
order (p:$,s:S):NonNegativeInteger ==
ground? p => 0
empty? (vv:= [order v for v in variables p | (variable v) = s ]) =>0
"max"/vv
degree (p, s) ==
d:NonNegativeInteger:=0
for lp in monomials p repeat
lv:= [v for v in variables lp | (variable v) = s ]
if not empty? lv then d:= max(d, +/degree(lp, lv))
d
weights p ==
ws:List NonNegativeInteger := nil
empty? (mp:=monomials p) => ws
for lp in mp repeat
lv:= variables lp
if not empty? lv then
dv:= degree(lp, lv)
w:=+/[(weight v) * d _
for v in lv for d in dv]$(List NonNegativeInteger)
ws:= concat(ws, w)
ws
weight p ==
empty? (ws:=weights p) => 0
"max"/ws
weights (p, s) ==
ws:List NonNegativeInteger := nil
empty?(mp:=monomials p) => ws
for lp in mp repeat
lv:= [v for v in variables lp | (variable v) = s ]
if not empty? lv then
dv:= degree(lp, lv)
w:=+/[(weight v) * d _
for v in lv for d in dv]$(List NonNegativeInteger)
ws:= concat(ws, w)
ws
weight (p,s) ==
empty? (ws:=weights(p,s)) => 0
"max"/ws
isobaric? p == (# removeDuplicates weights p) = 1
leader p == -- depends on the ranking
vl:= variables p
-- it's not enough just to look at leadingMonomial p
-- the term-ordering need not respect the ranking
empty? vl => error "leader is not defined "
"max"/vl
initial p == leadingCoefficient univariate(p,leader p)
separant p == differentiate(p, leader p)
coerce(s:S):$ == s::V::$
retractIfCan(p:$):Union(S, "failed") ==
(v := retractIfCan(p)@Union(V,"failed")) case "failed" => "failed"
retractIfCan(v::V)
differentialVariables p ==
removeDuplicates [variable v for v in variables p]
if R has DifferentialRing then
makeVariable p == n +-> differentiate(p, n)
eval(p:$, sl:List S, rl:List R) ==
ordp:= order p
vl := concat [[makeVariable(s,j)$V for j in 0..ordp]
for s in sl]$List(List V)
rrl:=nil$List(R)
for r in rl repeat
t:= r
rrl:= concat(rrl,
concat(r, [t := differentiate t for i in 1..ordp]))
eval(p, vl, rrl)
eval(p:$, sl:List S, rl:List $) ==
ordp:= order p
vl := concat [[makeVariable(s,j)$V for j in 0..ordp]
for s in sl]$List(List V)
rrl:=nil$List($)
for r in rl repeat
t:=r
rrl:=concat(rrl,
concat(r, [t:=differentiate t for i in 1..ordp]))
eval(p, vl, rrl)
eval(p:$, l:List Equation $) ==
eval(p, [retract(lhs e)@S for e in l]$List(S),
[rhs e for e in l]$List($))
|