⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 remez.qbk

📁 Boost provides free peer-reviewed portable C++ source libraries. We emphasize libraries that work
💻 QBK
📖 第 1 页 / 共 2 页
字号:
[section:remez The Remez Method]The [@http://en.wikipedia.org/wiki/Remez_algorithm Remez algorithm]is a methodology for locating the minimax rational approximationto a function.  This short article gives a brief overview of the method, butit should not be regarded as a thorough theoretical treatment, for that youshould consult your favorite textbook.Imagine that you want to approximate some function f(x) by way of a rationalfunction R(x), where R(x) may be either a polynomial P(x) or a ratio of twopolynomials P(x)/Q(x) (a rational function).  Initially we'll concentrate on the polynomial case, as it's by far the easier to deal with, later we'll extend to the full rational function case.  We want to find the "best" rational approximation, where"best" is defined to be the approximation that has the least deviationfrom f(x).  We can measure the deviation by way of an error function:E[sub abs](x) = f(x) - R(x)which is expressed in terms of absolute error, but we can equally userelative error:E[sub rel](x) = (f(x) - R(x)) / |f(x)|And indeed in general we can scale the error function in any way we want, itmakes no difference to the maths, although the two forms above cover almostevery practical case that you're likely to encounter.The minimax rational function R(x) is then defined to be the function thatyields the smallest maximal value of the error function.  Chebyshev showedthat there is a unique minimax solution for R(x) that has the followingproperties:* If R(x) is a polynomial of degree N, then there are N+2 unknowns:the N+1 coefficients of the polynomial, and maximal value of the errorfunction.* The error function has N+1 roots, and N+2 extrema (minima and maxima).* The extrema alternate in sign, and all have the same magnitude.That means that if we know the location of the extrema of the error functionthen we can write N+2 simultaneous equations:R(x[sub i]) + (-1)[super i]E = f(x[sub i])where E is the maximal error term, and x[sub i] are the abscissa values of theN+2 extrema of the error function.  It is then trivial to solve the simultaneousequations to obtain the polynomial coefficients and the error term.['Unfortunately we don't know where the extrema of the error function are located!][h4 The Remez Method]The Remez method is an iterative technique which, given a broad range ofassumptions, will converge on the extrema of the error function, and thereforethe minimax solution.In the following discussion we'll use a concrete example to illustratethe Remez method: an approximation to the function e[super x][space] overthe range \[-1, 1\].Before we can begin the Remez method, we must obtain an initial valuefor the location of the extrema of the error function.  We could "guess"these, but a much closer first approximation can be obtained by first  constructing an interpolated polynomial approximation to f(x).In order to obtain the N+1 coefficients of the interpolated polynomialwe need N+1 points (x[sub 0]...x[sub N]): with our interpolated form passing through each of those pointsthat yields N+1 simultaneous equations:f(x[sub i]) = P(x[sub i]) = c[sub 0] + c[sub 1]x[sub i] ... + c[sub N]x[sub i][super N]Which can be solved for the coefficients c[sub 0]...c[sub N] in P(x).Obviously this is not a minimax solution, indeed our only guarantee is that f(x) and P(x) touch at N+1 locations, away from those points the error may be arbitrarilylarge.  However, we would clearly like this initial approximation to be as close tof(x) as possible, and it turns out that using the zeros of an orthogonal polynomialas the initial interpolation points is a good choice.  In our example we'll use the zeros of a Chebyshev polynomial as these are particularly easy to calculate, interpolating for a polynomial of degree 4, and measuring /relative error/we get the following error function:[$../graphs/remez-2.png]Which has a peak relative error of 1.2x10[super -3].While this is a pretty good approximation already, judging by the shape of the error function we can clearly do better.  Before startingon the Remez method propper, we have one more step to perform: locateall the extrema of the error function, and storethese locations as our initial ['Chebyshev control points].[noteIn the simple case of a polynomial approximation, by interpolating throughthe roots of a Chebyshev polynomial we have in fact created a ['Chebyshevapproximation] to the function: in terms of /absolute error/this is the best a priori choice for the interpolated form we canachieve, and typically is very close to the minimax solution.However, if we want to optimise for /relative error/, or if the approximationis a rational function, then the initial Chebyshev solution can be quite farfrom the ideal minimax solution.  A more technical discussion of the theory involved can be found in this[@http://math.fullerton.edu/mathews/n2003/ChebyshevPolyMod.html online course].][h4 Remez Step 1]The first step in the Remez method, given our current set ofN+2 Chebyshev control points x[sub i], is to solve the N+2 simultaneousequations:P(x[sub i]) + (-1)[super i]E = f(x[sub i])To obtain the error term E, and the coefficients of the polynomial P(x).This gives us a new approximation to f(x) that has the same error /E/ ateach of the control points, and whose error function ['alternates in sign]at the control points.  This is still not necessarily the minimax solution though: since the control points may not be at the extrema of the errorfunction.  After this first step here's what our approximation's errorfunction looks like:[$../graphs/remez-3.png]Clearly this is still not the minimax solution since the control pointsare not located at the extrema, but the maximum relative error has nowdropped to 5.6x10[super -4].[h4 Remez Step 2]The second step is to locate the extrema of the new approximation, which we do in two stages:  first, since the error function changes sign at eachcontrol point, we must have N+1 roots of the error function located betweeneach pair of N+2 control points.  Once these roots are found by standard root finding techniques, we know that N extrema are bracketed between each pair ofroots, plus two more between the endpoints of the range and the first and last roots.The N+2 extrema can then be found using standard function minimisation techniques.We now have a choice: multi-point exchange, or single point exchange.In single point exchange, we move the control point nearest to the largest extrema tothe absissa value of the extrema.In multi-point exchange we swap all the current control points, for the locationsof the extrema.In our example we perform multi-point exchange.[h4 Iteration]The Remez method then performs steps 1 and 2 above iteratively until the controlpoints are located at the extrema of the error function: this is thenthe minimax solution.For our current example, two more iterations converges on a minimaxsolution with a peak relative error of5x10[super -4] and an error function that looks like:[$../graphs/remez-4.png][h4 Rational Approximations]If we wish to extend the Remez method to a rational approximation of the formf(x) = R(x) = P(x) / Q(x)where P(x) and Q(x) are polynomials, then we proceed as before, except that nowwe have N+M+2 unknowns if P(x) is of order N and Q(x) is of order M.  This assumesthat Q(x) is normalised so that it's leading coefficient is 1, givingN+M+1 polynomial coefficients in total, plus the error term E.The simultaneous equations to be solved are now:P(x[sub i]) / Q(x[sub i]) + (-1)[super i]E = f(x[sub i])Evaluated at the N+M+2 control points x[sub i].Unfortunately these equations are non-linear in the error term E: we can onlysolve them if we know E, and yet E is one of the unknowns!The method usually adopted to solve these equations is an iterative one: we guess thevalue of E, solve the equations to obtain a new value for E (as well as the polynomialcoefficients), then use the new value of E as the next guess.  The method isrepeated until E converges on a stable value.These complications extend the running time required for the development

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -