2.5.12 - Chebyshev Polynomial - JdlChebyshevPolynomial

John W. Campbell

2.5.12.1 Introduction

This class provides a means to store a Chebyshev polynomial with methods to evaluate the function value for a given coordinate.

Class, fields, constructor and methods:

Class Details
Accessible Fields
Constructor
Methods

2.5.12.2 Class Details

Package:
Jdl.JdlLib;
Class name:
JdlChebyshevPolynomial
Class definition:
public class JdlChebyshevPolynomial
Extends:
Object
Implements:
none
Actions:
none

2.5.12.3 Accessible Fields

The following accessible fields have been defined:

double xmin
double xmax
int n
double[] c
double outlim

2.5.12.4 Constructor

2.5.12.4.1 Introduction

A single constructor is available.

Constructor:

Standard constructor

2.5.12.4.2 Standard constructor

Constructs a JdlChebyshevPolynomial object with the required resources.

Constructor Definition:
public JdlChebyshevPolynomial(double xmin, double xmax, int n, double[] coeff, double outlim)
Parameters List:
xmin
Minimum 'x' used in polynomials calculation.
xmax
Maximum 'x' used in polynomials calculation.
n
The number of Chebyshev coefficients (polynomial order + 1).
coeff
Array of the'n' Chebyshev coefficients.
outlim
A value to be returned if an attempt is made to evaluate the polynomial outside the range 'xmin' to 'xmax'.

2.5.12.5 Methods

2.5.12.5.1 Introduction

This section contains methods to evaluate the function at a given coordinate.

Method:

Evaluate polynomial - evaluate
Evaluate polynomial - evaluate
Set 'outlim' - setOutlim
List data - listContents

2.5.12.5.2 Evaluate polynomial - evaluate

This method evaluates the polynomial for a given 'x' coordinate.

Method Definition:
public double evaluate(double x)
Parameters List:
x
The coordinate for which the function is to be evaluated.
Method Return:
The function value or the stored value of 'outlim' if the 'x' coordinate is out of range.

2.5.12.5.3 Evaluate polynomial - evaluate

This method evaluates the polynomial for a given 'x' coordinate.

Method Definition:
public double evaluate(double x, JdlError err)
Parameters List:
x
The coordinate for which the function is to be evaluated.
err
This returns details of any error. If the evaluation was OK then err.err is returned as false. If an error was found err.err is returned as true, err.flag is set and an error message is returned in err.msg1. Flag:
= -1, Polynomial not properly defined
= 1, 'x' coordinate out of range
Method Return:
The function value or the stored value of 'outlim' if the 'x' coordinate is out of range.

2.5.12.5.4 Set 'outlim' - setOutlim

This method sets the stored value of the 'outlim' parameter.

Method Definition:
public void setOutlim(double outlim)
Parameters List:
outlim
A value to be returned if an attempt is made to evaluate the polynomial outside the range 'xmin' to 'xmax'.

2.5.12.5.5 List data - listContents

This method lists the curve data to the standard output stream.

Method Definition:
public void listContents()
Parameters List:
none

⇑ Up 2   ⇑ Up 1   ⇑ Top of this