/usr/share/axiom-20170501/src/algebra/ISUMP.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 | )abbrev package ISUMP InnerPolySum
++ Author: SMW
++ Date Last Updated: 19 April 1991
++ Description:
++ Tools for the summation packages of polynomials
InnerPolySum(E, V, R, P) : SIG == CODE where
E : OrderedAbelianMonoidSup
V : OrderedSet
R : IntegralDomain
P : PolynomialCategory(R, E, V)
Z ==> Integer
Q ==> Fraction Z
SUP ==> SparseUnivariatePolynomial
SIG ==> with
sum : (P, V, Segment P) -> Record(num:P, den:Z)
++ sum(p(n), n = a..b) returns \spad{p(a) + p(a+1) + ... + p(b)}.
sum : (P, V) -> Record(num:P, den: Z)
++ sum(p(n), n) returns \spad{P(n)},
++ the indefinite sum of \spad{p(n)} with respect to
++ upward difference on n, \spad{P(n+1) - P(n) = a(n)};
CODE ==> add
import PolynomialNumberTheoryFunctions()
import UnivariatePolynomialCommonDenominator(Z, Q, SUP Q)
pmul: (P, SUP Q) -> Record(num:SUP P, den:Z)
pmul(c, p) ==
pn := (rec := splitDenominator p).num
[map(x +-> numer(x) * c, pn)_
$SparseUnivariatePolynomialFunctions2(Q, P), rec.den]
sum(p, v, s) ==
indef := sum(p, v)
[eval(indef.num, v, 1 + hi s) - eval(indef.num, v, lo s),
indef.den]
sum(p, v) ==
up := univariate(p, v)
lp := nil()$List(SUP P)
ld := nil()$List(Z)
while up ^= 0 repeat
ud := degree up; uc := leadingCoefficient up
up := reductum up
rec := pmul(uc, 1 / (ud+1) * bernoulli(ud+1))
lp := concat(rec.num, lp)
ld := concat(rec.den, ld)
d := lcm ld
vp := +/[(d exquo di)::Z * pi for di in ld for pi in lp]
[multivariate(vp, v), d]
|