axiom-developer
[Top][All Lists]

## [Axiom-developer] [RationalInterpolation] (nouveau)

 From: kratt6 Subject: [Axiom-developer] [RationalInterpolation] (nouveau) Date: Thu, 17 Mar 2005 03:39:25 -0600

Changes
http://page.axiom-developer.org/zope/mathaction/RationalInterpolation/diff
--
The package below implements rational interpolation.

\begin{axiom}
)abbrev package RINTERPA RationalInterpolationAlgorithms
++ Description:
++ This package exports rational interpolation algorithms
RationalInterpolationAlgorithms(F, P): Cat == Body   where
F: IntegralDomain
P: UnivariatePolynomialCategory(F)
Cat == with
RationalInterpolation: (List F, List F, NonNegativeInteger,
NonNegativeInteger)
-> Fraction P
+++ We assume that the elements of the first list are all distinct.
+++ If they are not, division by zero might occur.

RationalInterpolation(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)])
resspace: List Vector F := nullSpace((transpose matrix collist) _
::Matrix F)
reslist: List List P := _
[[monomial((resspace.1).(i+1), i) for i in 0..m], _
[monomial((resspace.1).(i+m+2), i) for i in 0..k]]

reduce((_+), reslist.1)/reduce((_+), reslist.2)

)abbrev package RINTERP RationalInterpolation
++ Description:
++ This package exports interpolation algorithms
RationalInterpolation(xx, F): Cat == Body   where
xx: Symbol
F:  IntegralDomain
UP  ==> UnivariatePolynomial
SUP ==> SparseUnivariatePolynomial

Cat == with
interpolate: (Fraction UP(xx, F), List F, List F, _
NonNegativeInteger, NonNegativeInteger) _
-> Fraction UP(xx, F)

interpolate: (List F, List F, NonNegativeInteger, NonNegativeInteger) _
-> Fraction SUP F

RIA ==> RationalInterpolationAlgorithms

interpolate(qx, lx, ly, m, k) ==
px := RationalInterpolation(lx, ly, m, k)$RIA(F, UP(xx, F)) elt(px, qx) interpolate(lx, ly, m, k) == RationalInterpolation(lx, ly, m, k)$RIA(F, SUP F)
\end{axiom}
--