Gottfried Helms on Thu, 17 Nov 2022 13:44:02 +0100

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Conversion of a function/closure with rational coefficients into one with real coefficients

I'm trying to optimize some bivariate function,
and found, that I can create a vector of polynomials p_r(x).
Let pp be a vector of closures, so for instance

 pp[4](x) =  1/4*x^2-2/3*x+1/6
 pp[5](x) = -1/8*x^3+31/48*x^2-7/12*x+1/24

But going in detail of the function I get vectors pp of
dimension 128 or 256 or the like, where in the denominators
are factorials of 128 or 256 and the like with very
long integer numbers.

By construction I get for all coefficients rational values,
but the complexity grows much with increasing index r
for pp[r](x).
That means, for numerical evaluation it should be much more
efficient to have that coefficients all in real values,
and I'm looking for a tool/procedure, to convert the
existing closures to that same functions, but with
coefficients expressed in real numbers.

I can't do, for instance, naive attempts like
 ppr[5]=1.0*pp[5], or ppr[5](x)=1.0*pp[5](x).

What is a good idea to convert the full vector "pp" into
some -say- "ppr" ?
(Well, I could recalculate all polynomials again from
the generating script, but I rather want to learn
the Pari/GP inherent tools for such a problem.)