/usr/share/axiom-20170501/src/algebra/ITAYLOR.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 | )abbrev domain ITAYLOR InnerTaylorSeries
++ Author: Clifton J. Williamson
++ Date Created: 21 December 1989
++ Date Last Updated: 25 February 1989
++ Description:
++ Internal package for dense Taylor series.
++ This is an internal Taylor series type in which Taylor series
++ are represented by a \spadtype{Stream} of \spadtype{Ring} elements.
++ For univariate series, the \spad{Stream} elements are the Taylor
++ coefficients. For multivariate series, the \spad{n}th Stream element
++ is a form of degree n in the power series variables.
InnerTaylorSeries(Coef) : SIG == CODE where
Coef : Ring
I ==> Integer
NNI ==> NonNegativeInteger
ST ==> Stream Coef
STT ==> StreamTaylorSeriesOperations Coef
SIG ==> Ring with
coefficients : % -> Stream Coef
++\spad{coefficients(x)} returns a stream of ring elements.
++ When x is a univariate series, this is a stream of Taylor
++ coefficients. When x is a multivariate series, the
++ \spad{n}th element of the stream is a form of
++ degree n in the power series variables.
series : Stream Coef -> %
++\spad{series(s)} creates a power series from a stream of
++ ring elements.
++ For univariate series types, the stream s should be a stream
++ of Taylor coefficients. For multivariate series types, the
++ stream s should be a stream of forms the \spad{n}th element
++ of which is a
++ form of degree n in the power series variables.
pole? : % -> Boolean
++\spad{pole?(x)} tests if the series x has a pole.
++ Note: this is false when x is a Taylor series.
order : % -> NNI
++\spad{order(x)} returns the order of a power series x,
++ that is, the degree of the first non-zero term of the series.
order : (%,NNI) -> NNI
++\spad{order(x,n)} returns the minimum of n and the order of x.
"*" : (Coef,%)->%
++\spad{c*x} returns the product of c and the series x.
"*" : (%,Coef)->%
++\spad{x*c} returns the product of c and the series x.
"*" : (%,Integer)->%
++\spad{x*i} returns the product of integer i and the series x.
if Coef has IntegralDomain then IntegralDomain
--++ An IntegralDomain provides 'exquo'
CODE ==> add
Rep := Stream Coef
--% declarations
x,y: %
--% definitions
-- In what follows, we will be calling operations on Streams
-- which are NOT defined in the package Stream. Thus, it is
-- necessary to explicitly pass back and forth between Rep and %.
-- This will be done using the functions 'stream' and 'series'.
stream : % -> Stream Coef
stream x == x pretend Stream(Coef)
series st == st @ %
0 == coerce(0)$STT
1 == coerce(1)$STT
x = y ==
-- tests if two power series are equal
-- difference must be a finite stream of zeroes of length <= n + 1,
-- where n = $streamCount$Lisp
st : ST := stream(x - y)
n : I := _$streamCount$Lisp
for i in 0..n repeat
empty? st => return true
frst st ^= 0 => return false
st := rst st
empty? st
coefficients x == stream x
x + y == stream(x) +$STT stream(y)
x - y == stream(x) -$STT stream(y)
(x:%) * (y:%) == stream(x) *$STT stream(y)
- x == -$STT (stream x)
(i:I) * (x:%) == (i::Coef) *$STT stream x
(x:%) * (i:I) == stream(x) *$STT (i::Coef)
(c:Coef) * (x:%) == c *$STT stream x
(x:%) * (c:Coef) == stream(x) *$STT c
recip x ==
(rec := recip$STT stream x) case "failed" => "failed"
series(rec :: ST)
if Coef has IntegralDomain then
x exquo y ==
(quot := stream(x) exquo$STT stream(y)) case "failed" => "failed"
series(quot :: ST)
x:% ** n:NNI ==
n = 0 => 1
expt(x,n :: PositiveInteger)$RepeatedSquaring(%)
characteristic() == characteristic()$Coef
pole? x == false
iOrder: (ST,NNI,NNI) -> NNI
iOrder(st,n,n0) ==
(n = n0) or (empty? st) => n0
zero? frst st => iOrder(rst st,n + 1,n0)
n
order(x,n) == iOrder(stream x,0,n)
iOrder2: (ST,NNI) -> NNI
iOrder2(st,n) ==
empty? st => error "order: series has infinite order"
zero? frst st => iOrder2(rst st,n + 1)
n
order x == iOrder2(stream x,0)
|