/usr/share/axiom-20170501/src/algebra/FSERIES.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 | )abbrev domain FSERIES FourierSeries
++ Author: James Davenport
++ Date Created: 17 April 1992
++ Description:
++ This domain converts terms into Fourier series
FourierSeries(R,E) : SIG == CODE where
R : Join(CommutativeRing,Algebra(Fraction Integer))
E : Join(OrderedSet,AbelianGroup)
SIG ==> Algebra(R) with
if E has canonical and R has canonical then canonical
coerce: R -> $
++ coerce(r) converts coefficients into Fourier Series
coerce: FourierComponent(E) -> $
++ coerce(c) converts sin/cos terms into Fourier Series
makeSin: (E,R) -> $
++ makeSin(e,r) makes a sin expression with given
++ argument and coefficient
makeCos: (E,R) -> $
++ makeCos(e,r) makes a sin expression with given
++argument and coefficient
CODE ==> FreeModule(R,FourierComponent(E)) add
--representations
Term := Record(k:FourierComponent(E),c:R)
Rep := List Term
multiply : (Term,Term) -> $
w,x1,x2:$
t1,t2:Term
n:NonNegativeInteger
z:Integer
e:FourierComponent(E)
a:E
r:R
1 == [[cos 0,1]]
coerce e ==
sin? e and zero? argument e => 0
if argument e < 0 then
not sin? e => e:=cos(- argument e)
return [[sin(- argument e),-1]]
[[e,1]]
multiply(t1,t2) ==
r:=(t1.c*t2.c)*(1/2)
s1:=argument t1.k
s2:=argument t2.k
sum:=s1+s2
diff:=s1-s2
sin? t1.k =>
sin? t2.k =>
makeCos(diff,r) + makeCos(sum,-r)
makeSin(sum,r) + makeSin(diff,r)
sin? t2.k =>
makeSin(sum,r) + makeSin(diff,r)
makeCos(diff,r) + makeCos(sum,r)
x1*x2 ==
null x1 => 0
null x2 => 0
+/[+/[multiply(t1,t2) for t2 in x2] for t1 in x1]
makeCos(a,r) ==
a<0 => [[cos(-a),r]]
[[cos a,r]]
makeSin(a,r) ==
zero? a => []
a<0 => [[sin(-a),-r]]
[[sin a,r]]
|