Open Maratyszcza opened 1 year ago
Hello Marat,
It's a bit of a gap that this isn't implemented by default. Part of the problem is that conversion to this fraction of polynomials representation isn't well-conditioned in general, so one can get into numerical trouble. As long as you only want to evaluate the rational function, it's better to stay in barycentric form.
But if you do need the numerator and denominator separately, the BarycentricRational
object already has methods numerator()
and denominator()
which will give them to you, although still in barycentric form. However, from there you can simply do polynomial interpolation or fitting (e.g. using numpy.polynomial) to get to any polynomial basis you like.
Hope that helps! Clemens
I'm trying to use BRASIL for function approximation with a fraction of polynomials.
Once I approximated a function and got a
BarycentricRational
object, how do I represent this object as a fraction of polynomials, e.g.(c0 + c1 * x + c2 * x^2) / (k0 + k1 * x + k2 * x^2)
? How do I getc0
,c1
,c2
,k0
,k1
,k2
from the barycentric representation?