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

NAG Library Routine Document

E02ACF

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

SUBROUTINE E02ACF ( X, Y, N, A, M1, REF)
INTEGER  N, M1
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
Px=a1+a2x+a3x2++am+1xm  
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:     XN – REAL (KIND=nag_wp) arrayInput
On entry: the values of the x coordinates, xi, for i=1,2,,n.
Constraint: x1<x2<<xn.
2:     YN – 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:     AM1 – 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  Parallelism and Performance

E02ACF is not threaded by NAG in any implementation.
E02ACF makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9  Further Comments

The time taken increases with m.

10  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.

10.1  Program Text

Program Text (e02acfe.f90)

10.2  Program Data

None.

10.3  Program Results

Program Results (e02acfe.r)

GnuplotProduced by GNUPLOT 4.6 patchlevel 3 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 gnuplot_plot_1 points on exp(x) gnuplot_plot_2 gnuplot_plot_3

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

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