Tell me more ×
Computational Science Stack Exchange is a question and answer site for scientists using computers to solve scientific problems. It's 100% free, no registration required.

I am looking for some open source implementation (any of Python, C, C++, Fortran is fine) of rational approximation to a function. Something along the article [1]. I give it a function and it gives me back two polynomials, whose ratio is the approximation on the given interval and the error is oscillating with the same amplitude and it is an optimal approximation, or close to it.

Here is what I found:

  • It looks like chebfun can do that, but I don't have access to Matlab *.

  • There is a simple program in the section 5-13 "Rational Chebyshev Approximation" in Numerical Recipes (NR).

  • Mathematica has EconomizedRationalApproximation and MiniMaxApproximation

I was wondering whether there is something newer (possibly better tested) than the NR code.

My application is that I have a set of special functions, about 10, which are given either as hypergeometric series, or some formula which has numerical cancellations, and I want to have a robust, fast and accurate evaluation function, that is being called in the inner most loop of calculating two particle matrix elements in Hartree Fock calculations. I put a simple example of a function that works for me at [2]. As you can see, it's either using a direct formula, or a series around x=0, that I calculated using SymPy. It sort of works, but the accuracy is not great, around x=1 about half of the significant digits are lost (but for x=0.1 as well as x=1e5 it is accurate to almost all significant digits). I am looking for a better approximation.

[1] Deun, J., & Trefethen, L. N. (2011). A robust implementation of the Carathéodory-Fejér method for rational approximation. BIT Numerical Mathematics, 51(4), 1039–1050. doi:10.1007/s10543-011-0331-7

[2] https://gist.github.com/3831580

(*) Nor to the chebfun website, which gives me 404, but Pedro suggested that must be my provider issue.

share|improve this question

1 Answer

up vote 1 down vote accepted

Might this be of any help? http://www.alglib.net/interpolation/rational.php

share|improve this answer
Thanks, I think this will do. I need to learn to use it. At the moment, I am under time press, so I just used MiniMaxApproximation from Mathematica to get the job done, but I want to learn to do this using opensource tools. – Ondřej Čertík Oct 5 '12 at 20:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.