This file is indexed.

/usr/share/axiom-20170501/src/algebra/EXPR2UPS.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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
)abbrev package EXPR2UPS ExpressionToUnivariatePowerSeries
++ Author: Clifton J. Williamson
++ Date Created: 9 May 1989
++ Date Last Updated: 20 September 1993
++ Description:
++ This package provides functions to convert functional expressions
++ to power series.

ExpressionToUnivariatePowerSeries(R,FE) : SIG == CODE where
  R : Join(GcdDomain,OrderedSet,RetractableTo Integer,_
           LinearlyExplicitRingOver Integer)
  FE : Join(AlgebraicallyClosedField,TranscendentalFunctionCategory,_
            FunctionSpace R)

  EQ     ==> Equation
  I      ==> Integer
  NNI    ==> NonNegativeInteger
  RN     ==> Fraction Integer
  SY     ==> Symbol
  UTS    ==> UnivariateTaylorSeries
  ULS    ==> UnivariateLaurentSeries
  UPXS   ==> UnivariatePuiseuxSeries
  GSER   ==> GeneralUnivariatePowerSeries
  EFULS  ==> ElementaryFunctionsUnivariateLaurentSeries
  EFUPXS ==> ElementaryFunctionsUnivariatePuiseuxSeries
  FS2UPS ==> FunctionSpaceToUnivariatePowerSeries
  Prob   ==> Record(func:String,prob:String)
  ANY1   ==> AnyFunctions1

  SIG ==> with

    taylor : SY -> Any
      ++ \spad{taylor(x)} returns x viewed as a Taylor series.

    taylor : FE -> Any
      ++ \spad{taylor(f)} returns a Taylor expansion of the expression f.
      ++ Note that f should have only one variable; the series will be
      ++ expanded in powers of that variable.

    taylor : (FE,NNI) -> Any
      ++ \spad{taylor(f,n)} returns a Taylor expansion of the expression f.
      ++ Note that f should have only one variable; the series will be
      ++ expanded in powers of that variable and terms will be computed
      ++ up to order at least n.

    taylor : (FE,EQ FE) -> Any
      ++ \spad{taylor(f,x = a)} expands the expression f as a Taylor series
      ++ in powers of \spad{(x - a)}.

    taylor : (FE,EQ FE,NNI) -> Any
      ++ \spad{taylor(f,x = a)} expands the expression f as a Taylor series
      ++ in powers of \spad{(x - a)}; terms will be computed up to order
      ++ at least n.

    laurent : SY -> Any
      ++ \spad{laurent(x)} returns x viewed as a Laurent series.

    laurent : FE -> Any
      ++ \spad{laurent(f)} returns a Laurent expansion of the expression f.
      ++ Note that f should have only one variable; the series will be
      ++ expanded in powers of that variable.

    laurent : (FE,I) -> Any
      ++ \spad{laurent(f,n)} returns a Laurent expansion of the expression f.
      ++ Note that f should have only one variable; the series will be
      ++ expanded in powers of that variable and terms will be computed
      ++ up to order at least n.

    laurent : (FE,EQ FE) -> Any
      ++ \spad{laurent(f,x = a)} expands the expression f as a Laurent series
      ++ in powers of \spad{(x - a)}.

    laurent : (FE,EQ FE,I) -> Any
      ++ \spad{laurent(f,x = a,n)} expands the expression f as a Laurent
      ++ series in powers of \spad{(x - a)}; terms will be computed up to order
      ++ at least n.

    puiseux : SY -> Any
      ++ \spad{puiseux(x)} returns x viewed as a Puiseux series.

    puiseux : FE -> Any
      ++ \spad{puiseux(f)} returns a Puiseux expansion of the expression f.
      ++ Note that f should have only one variable; the series will be
      ++ expanded in powers of that variable.

    puiseux : (FE,RN) -> Any
      ++ \spad{puiseux(f,n)} returns a Puiseux expansion of the expression f.
      ++ Note that f should have only one variable; the series will be
      ++ expanded in powers of that variable and terms will be computed
      ++ up to order at least n.

    puiseux : (FE,EQ FE) -> Any
      ++ \spad{puiseux(f,x = a)} expands the expression f as a Puiseux series
      ++ in powers of \spad{(x - a)}.

    puiseux : (FE,EQ FE,RN) -> Any
      ++ \spad{puiseux(f,x = a,n)} expands the expression f as a Puiseux
      ++ series in powers of \spad{(x - a)}; terms will be computed up to order
      ++ at least n.

    series : SY -> Any
      ++ \spad{series(x)} returns x viewed as a series.

    series : FE -> Any
      ++ \spad{series(f)} returns a series expansion of the expression f.
      ++ Note that f should have only one variable; the series will be
      ++ expanded in powers of that variable.

    series : (FE,RN) -> Any
      ++ \spad{series(f,n)} returns a series expansion of the expression f.
      ++ Note that f should have only one variable; the series will be
      ++ expanded in powers of that variable and terms will be computed
      ++ up to order at least n.

    series : (FE,EQ FE) -> Any
      ++ \spad{series(f,x = a)} expands the expression f as a series
      ++ in powers of (x - a).

    series : (FE,EQ FE,RN) -> Any
      ++ \spad{series(f,x = a,n)} expands the expression f as a series
      ++ in powers of (x - a); terms will be computed up to order
      ++ at least n.

  CODE ==> add

    performSubstitution: (FE,SY,FE) -> FE
    performSubstitution(fcn,x,a) ==
      zero? a => fcn
      xFE := x :: FE
      eval(fcn,xFE = xFE + a)

    iTaylor: (FE,SY,FE) -> Any
    iTaylor(fcn,x,a) ==
      pack := FS2UPS(R,FE,I,ULS(FE,x,a),_
                     EFULS(FE,UTS(FE,x,a),ULS(FE,x,a)),x)
      ans := exprToUPS(fcn,false,"just do it")$pack
      ans case %problem =>
        ans.%problem.prob = "essential singularity" =>
          error "No Taylor expansion: essential singularity"
        ans.%problem.func = "log" =>
          error "No Taylor expansion: logarithmic singularity"
        ans.%problem.func = "nth root" =>
          error "No Taylor expansion: fractional powers in expansion"
        error "No Taylor expansion"
      uls := ans.%series
      (uts := taylorIfCan uls) case "failed" =>
        error "No Taylor expansion: pole"
      any1 := ANY1(UTS(FE,x,a))
      coerce(uts :: UTS(FE,x,a))$any1

    taylor(x:SY) ==
      uts := UTS(FE,x,0$FE); any1 := ANY1(uts)
      coerce(monomial(1,1)$uts)$any1

    taylor(fcn:FE) ==
      null(vars := variables fcn) =>
        error "taylor: expression has no variables"
      not null rest vars =>
        error "taylor: expression has more than one variable"
      taylor(fcn,(first(vars) :: FE) = 0)

    taylor(fcn:FE,n:NNI) ==
      null(vars := variables fcn) =>
        error "taylor: expression has no variables"
      not null rest vars =>
        error "taylor: expression has more than one variable"
      x := first vars
      uts := UTS(FE,x,0$FE); any1 := ANY1(uts)
      series := retract(taylor(fcn,(x :: FE) = 0))$any1
      coerce(extend(series,n))$any1

    taylor(fcn:FE,eq:EQ FE) ==
      (xx := retractIfCan(lhs eq)@Union(SY,"failed")) case "failed" =>
        error "taylor: left hand side must be a variable"
      x := xx :: SY; a := rhs eq
      iTaylor(performSubstitution(fcn,x,a),x,a)

    taylor(fcn,eq,n) ==
      (xx := retractIfCan(lhs eq)@Union(SY,"failed")) case "failed" =>
        error "taylor: left hand side must be a variable"
      x := xx :: SY; a := rhs eq
      any1 := ANY1(UTS(FE,x,a))
      series := retract(iTaylor(performSubstitution(fcn,x,a),x,a))$any1
      coerce(extend(series,n))$any1

    iLaurent: (FE,SY,FE) -> Any
    iLaurent(fcn,x,a) ==
      pack := FS2UPS(R,FE,I,ULS(FE,x,a),_
                     EFULS(FE,UTS(FE,x,a),ULS(FE,x,a)),x)
      ans := exprToUPS(fcn,false,"just do it")$pack
      ans case %problem =>
        ans.%problem.prob = "essential singularity" =>
          error "No Laurent expansion: essential singularity"
        ans.%problem.func = "log" =>
          error "No Laurent expansion: logarithmic singularity"
        ans.%problem.func = "nth root" =>
          error "No Laurent expansion: fractional powers in expansion"
        error "No Laurent expansion"
      any1 := ANY1(ULS(FE,x,a))
      coerce(ans.%series)$any1

    laurent(x:SY) ==
      uls := ULS(FE,x,0$FE); any1 := ANY1(uls)
      coerce(monomial(1,1)$uls)$any1

    laurent(fcn:FE) ==
      null(vars := variables fcn) =>
        error "laurent: expression has no variables"
      not null rest vars =>
        error "laurent: expression has more than one variable"
      laurent(fcn,(first(vars) :: FE) = 0)

    laurent(fcn:FE,n:I) ==
      null(vars := variables fcn) =>
        error "laurent: expression has no variables"
      not null rest vars =>
        error "laurent: expression has more than one variable"
      x := first vars
      uls := ULS(FE,x,0$FE); any1 := ANY1(uls)
      series := retract(laurent(fcn,(x :: FE) = 0))$any1
      coerce(extend(series,n))$any1

    laurent(fcn:FE,eq:EQ FE) ==
      (xx := retractIfCan(lhs eq)@Union(SY,"failed")) case "failed" =>
        error "taylor: left hand side must be a variable"
      x := xx :: SY; a := rhs eq
      iLaurent(performSubstitution(fcn,x,a),x,a)

    laurent(fcn,eq,n) ==
      (xx := retractIfCan(lhs eq)@Union(SY,"failed")) case "failed" =>
        error "taylor: left hand side must be a variable"
      x := xx :: SY; a := rhs eq
      any1 := ANY1(ULS(FE,x,a))
      series := retract(iLaurent(performSubstitution(fcn,x,a),x,a))$any1
      coerce(extend(series,n))$any1

    iPuiseux: (FE,SY,FE) -> Any
    iPuiseux(fcn,x,a) ==
      pack := FS2UPS(R,FE,RN,UPXS(FE,x,a),_
                     EFUPXS(FE,ULS(FE,x,a),UPXS(FE,x,a),_
                     EFULS(FE,UTS(FE,x,a),ULS(FE,x,a))),x)
      ans := exprToUPS(fcn,false,"just do it")$pack
      ans case %problem =>
        ans.%problem.prob = "essential singularity" =>
          error "No Puiseux expansion: essential singularity"
        ans.%problem.func = "log" =>
          error "No Puiseux expansion: logarithmic singularity"
        error "No Puiseux expansion"
      any1 := ANY1(UPXS(FE,x,a))
      coerce(ans.%series)$any1

    puiseux(x:SY) ==
      upxs := UPXS(FE,x,0$FE); any1 := ANY1(upxs)
      coerce(monomial(1,1)$upxs)$any1

    puiseux(fcn:FE) ==
      null(vars := variables fcn) =>
        error "puiseux: expression has no variables"
      not null rest vars =>
        error "puiseux: expression has more than one variable"
      puiseux(fcn,(first(vars) :: FE) = 0)

    puiseux(fcn:FE,n:RN) ==
      null(vars := variables fcn) =>
        error "puiseux: expression has no variables"
      not null rest vars =>
        error "puiseux: expression has more than one variable"
      x := first vars
      upxs := UPXS(FE,x,0$FE); any1 := ANY1(upxs)
      series := retract(puiseux(fcn,(x :: FE) = 0))$any1
      coerce(extend(series,n))$any1

    puiseux(fcn:FE,eq:EQ FE) ==
      (xx := retractIfCan(lhs eq)@Union(SY,"failed")) case "failed" =>
        error "taylor: left hand side must be a variable"
      x := xx :: SY; a := rhs eq
      iPuiseux(performSubstitution(fcn,x,a),x,a)

    puiseux(fcn,eq,n) ==
      (xx := retractIfCan(lhs eq)@Union(SY,"failed")) case "failed" =>
        error "taylor: left hand side must be a variable"
      x := xx :: SY; a := rhs eq
      any1 := ANY1(UPXS(FE,x,a))
      series := retract(iPuiseux(performSubstitution(fcn,x,a),x,a))$any1
      coerce(extend(series,n))$any1

    iSeries: (FE,SY,FE) -> Any
    iSeries(fcn,x,a) ==
      pack := FS2UPS(R,FE,RN,UPXS(FE,x,a), _
                     EFUPXS(FE,ULS(FE,x,a),UPXS(FE,x,a), _
                     EFULS(FE,UTS(FE,x,a),ULS(FE,x,a))),x)
      ans := exprToUPS(fcn,false,"just do it")$pack
      ans case %problem =>
        ansG := exprToGenUPS(fcn,false,"just do it")$pack
        ansG case %problem =>
          ansG.%problem.prob = "essential singularity" =>
            error "No series expansion: essential singularity"
          error "No series expansion"
        anyone := ANY1(GSER(FE,x,a))
        coerce((ansG.%series) :: GSER(FE,x,a))$anyone
      any1 := ANY1(UPXS(FE,x,a))
      coerce(ans.%series)$any1

    series(x:SY) ==
      upxs := UPXS(FE,x,0$FE); any1 := ANY1(upxs)
      coerce(monomial(1,1)$upxs)$any1

    series(fcn:FE) ==
      null(vars := variables fcn) =>
        error "series: expression has no variables"
      not null rest vars =>
        error "series: expression has more than one variable"
      series(fcn,(first(vars) :: FE) = 0)

    series(fcn:FE,n:RN) ==
      null(vars := variables fcn) =>
        error "series: expression has no variables"
      not null rest vars =>
        error "series: expression has more than one variable"
      x := first vars
      upxs := UPXS(FE,x,0$FE); any1 := ANY1(upxs)
      series := retract(series(fcn,(x :: FE) = 0))$any1
      coerce(extend(series,n))$any1

    series(fcn:FE,eq:EQ FE) ==
      (xx := retractIfCan(lhs eq)@Union(SY,"failed")) case "failed" =>
        error "taylor: left hand side must be a variable"
      x := xx :: SY; a := rhs eq
      iSeries(performSubstitution(fcn,x,a),x,a)

    series(fcn,eq,n) ==
      (xx := retractIfCan(lhs eq)@Union(SY,"failed")) case "failed" =>
        error "taylor: left hand side must be a variable"
      x := xx :: SY; a := rhs eq
      any1 := ANY1(UPXS(FE,x,a))
      series := retract(iSeries(performSubstitution(fcn,x,a),x,a))$any1
      coerce(extend(series,n))$any1