/usr/share/axiom-20170501/src/algebra/RINTERP.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 | )abbrev package RINTERP RationalInterpolation
++ Description:
++ This package exports rational interpolation algorithms
RationalInterpolation(xx,F) : SIG == CODE where
xx : Symbol
F : Field
SIG ==> with
interpolate : (List F, List F, NonNegativeInteger,
NonNegativeInteger) -> Fraction Polynomial F
CODE ==> add
interpolate(xlist, ylist, m, k) ==
#xlist ^= #ylist =>
error "Different number of points and values."
#xlist ^= m+k+1 =>
error "wrong number of points"
tempvec: List F := [1 for i in 1..(m+k+1)]
collist: List List F := cons(tempvec,
[(tempvec := [tempvec.i * xlist.i _
for i in 1..(m+k+1)]) _
for j in 1..max(m,k)])
collist := append([collist.j for j in 1..(m+1)], _
[[- collist.j.i * ylist.i for i in 1..(m+k+1)] _
for j in 1..(k+1)])
res: List Vector F := nullSpace((transpose matrix collist) _
::Matrix F)
if #res~=1 then output("Warning: unattainable points!" _
::OutputForm)$OutputPackage
reslist: List List Polynomial F := _
[[(res.1).(i+1)*(xx::Polynomial F)**i for i in 0..m], _
[(res.1).(i+m+2)*(xx::Polynomial F)**i for i in 0..k]]
reduce((_+),reslist.1)/reduce((_+),reslist.2)
|