Name:

fpminimax computes a good polynomial approximation with fixed-point or floating-point coefficients

Usage:

fpminimax(f, n, formats, range, indic1, indic2, indic3, P) : (function, integer, list, range, absolute|relative | fixed|floating | function, absolute|relative | fixed|floating | function, absolute|relative | fixed|floating | function, function) -> function fpminimax(f, monomials, formats, range, indic1, indic2, indic3, P) : (function, list, list, range, absolute|relative | fixed|floating | function, absolute|relative | fixed|floating | function, absolute|relative | fixed|floating | function, function) -> function fpminimax(f, n, formats, L, indic1, indic2, indic3, P) : (function, integer, list, list, absolute|relative | fixed|floating | function, absolute|relative | fixed|floating | function, absolute|relative | fixed|floating | function, function) -> function fpminimax(f, monomials, formats, L, indic1, indic2, indic3, P) : (function, list, list, list, absolute|relative | fixed|floating | function, absolute|relative | fixed|floating | function, absolute|relative | fixed|floating | function, function) -> function

Parameters:

Description:

Example 1:

   > P = fpminimax(cos(x),6,[|DD, DD, D...|],[-1b-5;1b-5]);
   > printexpansion(P);
   (0x3ff0000000000000 + 0xbc09fda20235c100) + x * ((0x3b29ecd485d34781 + 0xb7c1cbc97120359a) + x * (0xbfdfffffffffff98 + x * (0xbbfa6e0b3183cb0d + x * (0x3fa5555555145337 + x * (0x3ca3540480618939 + x * 0xbf56c138142d8c3b)))))

Example 2:

   > P = fpminimax(sin(x),6,[|32...|],[-1b-5;1b-5], fixed, absolute);
   > display = powers!;
   > P;
   x * (1 + x^2 * (-357913941 * 2^(-31) + x^2 * (35789873 * 2^(-32))))

Example 3:

   > P = fpminimax(exp(x), [|3,4|], [|D,24|], [-1/256; 1/246], 1+x+x^2/2);
   > display = powers!;
   > P;
   1 + x * (1 + x * (1 * 2^(-1) + x * (375300225001191 * 2^(-51) + x * (5592621 * 2^(-27)))))

Example 4:

   > f = cos(exp(x));
   > pstar = remez(f, 5, [-1b-7;1b-7]);
   > listpoints = dirtyfindzeros(f-pstar, [-1b-7; 1b-7]);
   > P1 = fpminimax(f, 5, [|DD...|], listpoints, absolute, default, default, pstar);
   > P2 = fpminimax(f, 5, [|D...|], listpoints, absolute, default, default, pstar);
   > P3 = fpminimax(f, 5, [|D, D, D, 24...|], listpoints, absolute, default, default, pstar);
   > print("Error of pstar: ", dirtyinfnorm(f-pstar, [-1b-7; 1b-7]));
   Error of pstar:  7.9048441305459735102879831325718745399379329453102e-16
   > print("Error of P1:    ", dirtyinfnorm(f-P1, [-1b-7; 1b-7]));
   Error of P1:     7.9048441305459735159848647089192667442047469404883e-16
   > print("Error of P2:    ", dirtyinfnorm(f-P2, [-1b-7; 1b-7]));
   Error of P2:     8.2477144579950871061147021597406077993657714575238e-16
   > print("Error of P3:    ", dirtyinfnorm(f-P3, [-1b-7; 1b-7]));
   Error of P3:     1.08454277156993282593701156841863009789063333951055e-15
See also: remez, dirtyfindzeros, absolute, relative, fixed, floating, default, single, double, doubledouble, tripledouble, doubleextended, implementpoly, coeff, degree, roundcoefficients, guessdegree
Go back to the list of commands