Remez algorithm for polynomial approximation.
remezeps:=0.00001;
function remez (x,y,deg,tracing=0) Best polynomial approximation. The Remez algorithm computes the best polynomial approximation to the data (x[i],y[1]) of degree deg. This algorithm uses a simultanous exchange, which requires the points x[i] to be sorted. x : vector of points on the real line, sorted. y : vector of values at these points. deg : degree of the polynomial. tracing : if non-zero, the steps will be plotted. Returns {t,d,h,r} t : the alternation points d : the divided difference form of the best approximant h : the discrete error (with sign) r : the rightmost alternation point, which is missing in t. To evaluate the polynomial in v use interpval(t,d,v).