ratinterpol does not reproduce rational function



ratinterpol(float(h),2) gives the correct result (within 1e-8 or so) after
you eliminate small coefficients and rationalize the result.

On Thu, Dec 27, 2012 at 5:53 AM, Mario Rodriguez <biomates at telefonica.net>wrote:

> El jue, 27-12-2012 a las 02:23 +0100, andre maute escribi?:
> > Hi list,
> >
> > I have the following test case
> >
> > --- ratinterpol.mac ------------
> > display2d : false;
> > load(interpol);
> > h : makelist( [k,-2*(k+1)*(2*k+1)/(k*(k+2))], k,1,12);
> > ratinterpol(h,2);
> > --- ratinterpol.mac ------------
> >
> > I get this unexpected behavior
> >
> > --- output -------------
> > $ maxima -b ratinterpol.mac
> > Maxima 5.27.0 http://maxima.sourceforge.net
> > using Lisp SBCL 1.0.57-1.fc17
> > Distributed under the GNU Public License. See the file COPYING.
> > Dedicated to the memory of William Schelter.
> > The function bug_report() provides bug reporting information.
> > STYLE-WARNING: redefining MAXIMA::$FILE_TYPE in DEFUN
> > (%i1) batch(ratinterpol.mac)
> >
> > read and interpret file: /home/user/ratinterpol.mac
> > (%i2) display2d : false
> > (%o2) false
> > (%i3) load(interpol)
> > (%o3)
> "/home/user/opt/maxima/share/maxima/5.27.0/share/numeric/interpol.mac"
> > (%i4) h:makelist([k,(-2*(1+k)*(1+2*k))/(k*(2+k))],k,1,12)
> > (%o4)
> >
> [[1,-4],[2,-15/4],[3,-56/15],[4,-15/4],[5,-132/35],[6,-91/24],[7,-80/21],[8,-153/40],[9,-380/99],[10,-77/20],[11,-552/143],[12,-325/84]]
> > (%i5) ratinterpol(h,2)
> > Unable to compute the LU factorization
> > #0:
> >
> ratinterpol(tab=[[1,-4],[2,-15/4],[3,-56/15],[4,-15/4],[5,-132/35],[6,-91/24],[7,-80/21],[8,-153/40],[9,-380/99],[10...,r=2,select=[])(linearalgebra.mac
> > line 310)
> >   -- an error. To debug this try: debugmode(true);
> > (%o5) "/home/user/ratinterpol.mac"
> > --- output -------------
>
>
> Hello,
>
> ratinterpol calls linsolve_by_lu to solve a linear system that gives the
> values of the coefficients of the two polynomials in the rational
> function.
>
> In your example, the linear system built by ratinterpol is not
> compatible. Maybe there is not any rational function with degree 2 in
> the numerator such that it passes thru all the sample points. The degree
> of the denominator is automatically calculated so that the there are as
> many unknowns as equations.
>
> Perhaps you can change the second argument to ratinterpol and try other
> degrees for the numerator.
>
> --
> Mario
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>