/usr/share/axiom-20170501/src/algebra/SUMRF.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 | )abbrev package SUMRF RationalFunctionSum
++ Author: Manuel Bronstein
++ Date Created: ???
++ Date Last Updated: 19 April 1991
++ Description:
++ Computes sums of rational functions;
RationalFunctionSum(R) : SIG == CODE where
R: Join(IntegralDomain, OrderedSet, RetractableTo Integer)
P ==> Polynomial R
RF ==> Fraction P
FE ==> Expression R
SE ==> Symbol
SIG ==> with
sum : (P, SE) -> RF
++ sum(a(n), n) returns \spad{A} which
++ is the indefinite sum of \spad{a} with respect to
++ upward difference on \spad{n}, \spad{A(n+1) - A(n) = a(n)}.
++
++X sum(i::Polynomial(Integer),variable(i=1..n))
sum : (RF, SE) -> Union(RF, FE)
++ sum(a(n), n) returns \spad{A} which
++ is the indefinite sum of \spad{a} with respect to
++ upward difference on \spad{n}, \spad{A(n+1) - A(n) = a(n)}.
++
++X sum(i::Fraction(Polynomial(Integer)),i::Symbol)
sum : (P, SegmentBinding P) -> RF
++ sum(f(n), n = a..b) returns \spad{f(a) + f(a+1) + ... f(b)}.
++
++X sum(i,i=1..n)
sum : (RF, SegmentBinding RF) -> Union(RF, FE)
++ sum(f(n), n = a..b) returns \spad{f(a) + f(a+1) + ... f(b)}.
++
++X sum(i::Fraction(Polynomial(Integer)),i=1..n)
CODE ==> add
import RationalFunction R
import GosperSummationMethod(IndexedExponents SE, SE, R, P, RF)
innersum : (RF, SE) -> Union(RF, "failed")
innerpolysum: (P, SE) -> RF
sum(f:RF, s:SegmentBinding RF) ==
(indef := innersum(f, v := variable s)) case "failed" =>
summation(f::FE,map((z:RF):FE +->z::FE,s)
$SegmentBindingFunctions2(RF,FE))
eval(indef::RF, v, 1 + hi segment s)
- eval(indef::RF, v,lo segment s)
sum(an:RF, n:SE) ==
(u := innersum(an, n)) case "failed" => summation(an::FE, n)
u::RF
sum(p:P, s:SegmentBinding P) ==
f := sum(p, v := variable s)
eval(f, v, (1 + hi segment s)::RF) - eval(f,v,lo(segment s)::RF)
innersum(an, n) ==
(r := retractIfCan(an)@Union(P, "failed")) case "failed" =>
an1 := eval(an, n, -1 + n::RF)
(u := GospersMethod(an/an1, n, new$SE)) case "failed" =>
"failed"
an1 * eval(u::RF, n, -1 + n::RF)
sum(r::P, n)
sum(p:P, n:SE) ==
rec := sum(p, n)$InnerPolySum(IndexedExponents SE, SE, R, P)
rec.num / (rec.den :: P)
|