E02ACF (PDF version)
E02 Chapter Contents
E02 Chapter Introduction
NAG Library Manual

NAG Library Routine Document


Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

E02ACF calculates a minimax polynomial fit to a set of data points.

2  Specification

REAL (KIND=nag_wp)  X(N), Y(N), A(M1), REF

3  Description

Given a set of data points xi,yi, for i=1,2,,n, E02ACF uses the exchange algorithm to compute an mth-order polynomial
such that maxi2Pxi-yi is a minimum.
The routine also returns a number whose absolute value is the final reference deviation (see Section 6). The routine is an adaptation of Boothroyd (1967).

4  References

Boothroyd J B (1967) Algorithm 318 Comm. ACM 10 801
Stieffel E (1959) Numerical methods of Tchebycheff approximation On Numerical Approximation (ed R E Langer) 217–232 University of Wisconsin Press

5  Parameters

1:     X(N) – REAL (KIND=nag_wp) arrayInput
On entry: the values of the x coordinates, xi, for i=1,2,,n.
Constraint: x1<x2<<xn.
2:     Y(N) – REAL (KIND=nag_wp) arrayInput
On entry: the values of the y coordinates, yi, for i=1,2,,n.
3:     N – INTEGERInput
On entry: the number n of data points.
4:     A(M1) – REAL (KIND=nag_wp) arrayOutput
On exit: the coefficients ai of the final polynomial, for i=1,2,,m+1.
5:     M1 – INTEGERInput
On entry: m+1, where m is the order of the polynomial to be found.
Constraint: M1<minN,100.
6:     REF – REAL (KIND=nag_wp)Output
On exit: the final reference deviation (see Section 6).

6  Error Indicators and Warnings

If an error is detected in an input parameter E02ACF will act as if a soft noisy exit has been requested (see Section 3.3.4 in the Essential Introduction).

7  Accuracy

This is wholly dependent on the given data points.

8  Further Comments

The time taken increases with m.

9  Example

This example calculates a minimax fit with a polynomial of degree 5 to the exponential function evaluated at 21 points over the interval 0,1. It then prints values of the function and the fitted polynomial.

9.1  Program Text

Program Text (e02acfe.f90)

9.2  Program Data


9.3  Program Results

Program Results (e02acfe.r)

Produced by GNUPLOT 4.4 patchlevel 0 0 0.5 1 1.5 2 2.5 3 0 0.2 0.4 0.6 0.8 1 1e-07 1e-06 1e-05 0.0001 0.001 Polynomial P(x) | P ( x ) - exp( x ) | x Example Program Minimax Fit to the Exponential Function on the Interval [0,1] using a Degree Five Polynomial, P(x), given exp(x) Evaluated at 21 Points |P(x) - exp(x)| polynomial fit points on exp(x)

E02ACF (PDF version)
E02 Chapter Contents
E02 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012