/usr/share/axiom-20170501/src/algebra/GENUPS.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 | )abbrev package GENUPS GenerateUnivariatePowerSeries
++ Author: Clifton J. Williamson
++ Date Created: 29 April 1990
++ Date Last Updated: 31 May 1990
++ Description:
++ \spadtype{GenerateUnivariatePowerSeries} provides functions that create
++ power series from explicit formulas for their \spad{n}th coefficient.
GenerateUnivariatePowerSeries(R,FE) : SIG == CODE where
R : Join(IntegralDomain,OrderedSet,RetractableTo Integer,_
LinearlyExplicitRingOver Integer)
FE : Join(AlgebraicallyClosedField,TranscendentalFunctionCategory,_
FunctionSpace R)
ANY1 ==> AnyFunctions1
EQ ==> Equation
I ==> Integer
NNI ==> NonNegativeInteger
RN ==> Fraction Integer
SEG ==> UniversalSegment
ST ==> Stream
SY ==> Symbol
UTS ==> UnivariateTaylorSeries
ULS ==> UnivariateLaurentSeries
UPXS ==> UnivariatePuiseuxSeries
SIG ==> with
taylor : (I -> FE,EQ FE) -> Any
++ \spad{taylor(n +-> a(n),x = a)} returns
++ \spad{sum(n = 0..,a(n)*(x-a)**n)}.
taylor : (FE,SY,EQ FE) -> Any
++ \spad{taylor(a(n),n,x = a)} returns \spad{sum(n = 0..,a(n)*(x-a)**n)}.
taylor : (I -> FE,EQ FE,SEG NNI) -> Any
++ \spad{taylor(n +-> a(n),x = a,n0..)} returns
++ \spad{sum(n=n0..,a(n)*(x-a)**n)};
++ \spad{taylor(n +-> a(n),x = a,n0..n1)} returns
++ \spad{sum(n = n0..,a(n)*(x-a)**n)}.
taylor : (FE,SY,EQ FE,SEG NNI) -> Any
++ \spad{taylor(a(n),n,x = a,n0..)} returns
++ \spad{sum(n = n0..,a(n)*(x-a)**n)};
++ \spad{taylor(a(n),n,x = a,n0..n1)} returns
++ \spad{sum(n = n0..,a(n)*(x-a)**n)}.
laurent : (I -> FE,EQ FE,SEG I) -> Any
++ \spad{laurent(n +-> a(n),x = a,n0..)} returns
++ \spad{sum(n = n0..,a(n) * (x - a)**n)};
++ \spad{laurent(n +-> a(n),x = a,n0..n1)} returns
++ \spad{sum(n = n0..n1,a(n) * (x - a)**n)}.
laurent : (FE,SY,EQ FE,SEG I) -> Any
++ \spad{laurent(a(n),n,x=a,n0..)} returns
++ \spad{sum(n = n0..,a(n) * (x - a)**n)};
++ \spad{laurent(a(n),n,x=a,n0..n1)} returns
++ \spad{sum(n = n0..n1,a(n) * (x - a)**n)}.
puiseux : (RN -> FE,EQ FE,SEG RN,RN) -> Any
++ \spad{puiseux(n +-> a(n),x = a,r0..,r)} returns
++ \spad{sum(n = r0,r0 + r,r0 + 2*r..., a(n) * (x - a)**n)};
++ \spad{puiseux(n +-> a(n),x = a,r0..r1,r)} returns
++ \spad{sum(n = r0 + k*r while n <= r1, a(n) * (x - a)**n)}.
puiseux : (FE,SY,EQ FE,SEG RN,RN) -> Any
++ \spad{puiseux(a(n),n,x = a,r0..,r)} returns
++ \spad{sum(n = r0,r0 + r,r0 + 2*r..., a(n) * (x - a)**n)};
++ \spad{puiseux(a(n),n,x = a,r0..r1,r)} returns
++ \spad{sum(n = r0 + k*r while n <= r1, a(n) * (x - a)**n)}.
series : (I -> FE,EQ FE) -> Any
++ \spad{series(n +-> a(n),x = a)} returns
++ \spad{sum(n = 0..,a(n)*(x-a)**n)}.
series : (FE,SY,EQ FE) -> Any
++ \spad{series(a(n),n,x = a)} returns
++ \spad{sum(n = 0..,a(n)*(x-a)**n)}.
series : (I -> FE,EQ FE,SEG I) -> Any
++ \spad{series(n +-> a(n),x = a,n0..)} returns
++ \spad{sum(n = n0..,a(n) * (x - a)**n)};
++ \spad{series(n +-> a(n),x = a,n0..n1)} returns
++ \spad{sum(n = n0..n1,a(n) * (x - a)**n)}.
series : (FE,SY,EQ FE,SEG I) -> Any
++ \spad{series(a(n),n,x=a,n0..)} returns
++ \spad{sum(n = n0..,a(n) * (x - a)**n)};
++ \spad{series(a(n),n,x=a,n0..n1)} returns
++ \spad{sum(n = n0..n1,a(n) * (x - a)**n)}.
series : (RN -> FE,EQ FE,SEG RN,RN) -> Any
++ \spad{series(n +-> a(n),x = a,r0..,r)} returns
++ \spad{sum(n = r0,r0 + r,r0 + 2*r..., a(n) * (x - a)**n)};
++ \spad{series(n +-> a(n),x = a,r0..r1,r)} returns
++ \spad{sum(n = r0 + k*r while n <= r1, a(n) * (x - a)**n)}.
series : (FE,SY,EQ FE,SEG RN,RN) -> Any
++ \spad{series(a(n),n,x = a,r0..,r)} returns
++ \spad{sum(n = r0,r0 + r,r0 + 2*r..., a(n) * (x - a)**n)};
++ \spad{series(a(n),n,x = a,r0..r1,r)} returns
++ \spad{sum(n = r0 + k*r while n <= r1, a(n) * (x - a)**n)}.
CODE ==> add
genStream: (I -> FE,I) -> ST FE
genStream(f,n) == delay concat(f(n),genStream(f,n + 1))
genFiniteStream: (I -> FE,I,I) -> ST FE
genFiniteStream(f,n,m) == delay
n > m => empty()
concat(f(n),genFiniteStream(f,n + 1,m))
taylor(f,eq) ==
(xx := retractIfCan(lhs eq)@Union(SY,"failed")) case "failed" =>
error "taylor: left hand side must be a variable"
x := xx :: SY; a := rhs eq
coerce(series(genStream(f,0))$UTS(FE,x,a))$ANY1(UTS(FE,x,a))
taylor(an:FE,n:SY,eq:EQ FE) ==
taylor((i:I):FE +-> eval(an,(n::FE) = (i::FE)),eq)
taylor(f:I -> FE,eq:EQ FE,seg:SEG NNI) ==
(xx := retractIfCan(lhs eq)@Union(SY,"failed")) case "failed" =>
error "taylor: left hand side must be a variable"
x := xx :: SY; a := rhs eq
hasHi seg =>
n0 := lo seg; n1 := hi seg
if n1 < n0 then (n0,n1) := (n1,n0)
uts := series(genFiniteStream(f,n0,n1))$UTS(FE,x,a)
uts := uts * monomial(1,n0)$UTS(FE,x,a)
coerce(uts)$ANY1(UTS(FE,x,a))
n0 := lo seg
uts := series(genStream(f,n0))$UTS(FE,x,a)
uts := uts * monomial(1,n0)$UTS(FE,x,a)
coerce(uts)$ANY1(UTS(FE,x,a))
taylor(an,n,eq,seg) ==
taylor((i:I):FE +-> eval(an,(n::FE) = (i::FE)),eq,seg)
laurent(f,eq,seg) ==
(xx := retractIfCan(lhs eq)@Union(SY,"failed")) case "failed" =>
error "taylor: left hand side must be a variable"
x := xx :: SY; a := rhs eq
hasHi seg =>
n0 := lo seg; n1 := hi seg
if n1 < n0 then (n0,n1) := (n1,n0)
uts := series(genFiniteStream(f,n0,n1))$UTS(FE,x,a)
coerce(laurent(n0,uts)$ULS(FE,x,a))$ANY1(ULS(FE,x,a))
n0 := lo seg
uts := series(genStream(f,n0))$UTS(FE,x,a)
coerce(laurent(n0,uts)$ULS(FE,x,a))$ANY1(ULS(FE,x,a))
laurent(an,n,eq,seg) ==
laurent((i:I):FE +-> eval(an,(n::FE) = (i::FE)),eq,seg)
modifyFcn:(RN -> FE,I,I,I,I) -> FE
modifyFcn(f,n0,nn,q,m) == (zero?((m - n0) rem nn) => f(m/q); 0)
puiseux(f,eq,seg,r) ==
(xx := retractIfCan(lhs eq)@Union(SY,"failed")) case "failed" =>
error "puiseux: left hand side must be a variable"
x := xx :: SY; a := rhs eq
not positive? r => error "puiseux: last argument must be positive"
hasHi seg =>
r0 := lo seg; r1 := hi seg
if r1 < r0 then (r0,r1) := (r1,r0)
p0 := numer r0; q0 := denom r0
p1 := numer r1; q1 := denom r1
p2 := numer r; q2 := denom r
q := lcm(lcm(q0,q1),q2)
n0 := p0 * (q quo q0); n1 := p1 * (q quo q1)
nn := p2 * (q quo q2)
ulsUnion :=
laurent((i:I):FE+->modifyFcn(f,n0,nn,q,i),eq,segment(n0,n1))
uls := retract(ulsUnion)$ANY1(ULS(FE,x,a))
coerce(puiseux(1/q,uls)$UPXS(FE,x,a))$ANY1(UPXS(FE,x,a))
p0 := numer(r0 := lo seg); q0 := denom r0
p2 := numer r; q2 := denom r
q := lcm(q0,q2)
n0 := p0 * (q quo q0); nn := p2 * (q quo q2)
ulsUnion :=
laurent((i:I):FE+->modifyFcn(f,n0,nn,q,i),eq,segment n0)
uls := retract(ulsUnion)$ANY1(ULS(FE,x,a))
coerce(puiseux(1/q,uls)$UPXS(FE,x,a))$ANY1(UPXS(FE,x,a))
puiseux(an,n,eq,r0,m) ==
puiseux((r:RN):FE+->eval(an,(n::FE) = (r::FE)),eq,r0,m)
series(f:I -> FE,eq:EQ FE) == puiseux(r+->f(numer r),eq,segment 0,1)
series(an:FE,n:SY,eq:EQ FE) == puiseux(an,n,eq,segment 0,1)
series(f:I -> FE,eq:EQ FE,seg:SEG I) ==
ratSeg : SEG RN := map(x+->x::RN,seg)$UniversalSegmentFunctions2(I,RN)
puiseux((r:RN):FE+->f(numer r),eq,ratSeg,1)
series(an:FE,n:SY,eq:EQ FE,seg:SEG I) ==
ratSeg : SEG RN := map(i+->i::RN,seg)$UniversalSegmentFunctions2(I,RN)
puiseux(an,n,eq,ratSeg,1)
series(f:RN -> FE,eq:EQ FE,seg:SEG RN,r:RN) == puiseux(f,eq,seg,r)
series(an:FE,n:SY,eq:EQ FE,seg:SEG RN,r:RN) == puiseux(an,n,eq,seg,r)
|