Bill Allombert on Thu, 17 Nov 2022 18:26:52 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Conversion of a function/closure with rational coefficients into one with real coefficients |
On Thu, Nov 17, 2022 at 01:42:58PM +0100, Gottfried Helms wrote: > 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 > ... Why not write pp[4] = 1/4*x^2-2/3*x+1/6 pp[5] = -1/8*x^3+31/48*x^2-7/12*x+1/24 and use subst to evaluate pp[i] when needed ? Cheers, Bill