/usr/share/axiom-20170501/src/algebra/SUMFS.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 SUMFS FunctionSpaceSum
++ Author: Manuel Bronstein
++ Date Last Updated: 19 April 1991
++ Description:
++ Computes sums of top-level expressions
FunctionSpaceSum(R, F) : SIG == CODE where
R : Join(IntegralDomain, OrderedSet,
RetractableTo Integer, LinearlyExplicitRingOver Integer)
F : Join(FunctionSpace R, CombinatorialOpsCategory,
AlgebraicallyClosedField, TranscendentalFunctionCategory)
SE ==> Symbol
K ==> Kernel F
SIG ==> with
sum : (F, SE) -> F
++ sum(a(n), n) returns A(n) such that A(n+1) - A(n) = a(n);
sum : (F, SegmentBinding F) -> F
++ sum(f(n), n = a..b) returns f(a) + f(a+1) + ... + f(b);
CODE ==> add
import ElementaryFunctionStructurePackage(R, F)
import GosperSummationMethod(IndexedExponents K, K, R,
SparseMultivariatePolynomial(R, K), F)
innersum: (F, K) -> Union(F, "failed")
notRF? : (F, K) -> Boolean
newk : () -> K
newk() == kernel(new()$SE)
sum(x:F, s:SegmentBinding F) ==
k := kernel(variable s)@K
(u := innersum(x, k)) case "failed" => summation(x, s)
eval(u::F, k, 1 + hi segment s) - eval(u::F, k, lo segment s)
sum(x:F, v:SE) ==
(u := innersum(x, kernel(v)@K)) case "failed" => summation(x,v)
u::F
notRF?(f, k) ==
for kk in tower f repeat
member?(k, tower(kk::F)) and (symbolIfCan(kk) case "failed") =>
return true
false
innersum(x, k) ==
zero? x => 0
notRF?(f := normalize(x / (x1 := eval(x, k, k::F - 1))), k) =>
"failed"
(u := GospersMethod(f, k, newk)) case "failed" => "failed"
x1 * eval(u::F, k, k::F - 1)
|