Chapter Contents Previous Next
 Language Reference

## ORPOL Function

generates orthogonal polynomials

ORPOL( vector<, maxdegree<, weights>>)

The inputs to the ORPOL function are as follows:
vector
is an n ×1 (or 1 ×n) vector of values over which the polynomials are to be defined.

maxdegree
specifies the maximum degree polynomial to be computed. Note that the number of columns in the computed result is 1+maxdegree, whether maxdegree is specified or the default value is used. If maxdegree is omitted, IML uses the default value min(n,19). If weights is specified, maxdegree must also be specified.

weights
specifies an n ×1 (or 1 ×n) vector of nonnegative weights to be used in defining orthogonality:
P'* diag( weights)P = I   .
If you specify weights, you must also specify maxdegree. If maxdegree is not specified or is specified incorrectly, the default weights (all weights are 1) are used.
The ORPOL matrix function generates orthogonal polynomials. The result is a column-orthonormal matrix P with the same number of rows as the vector and with maxdegree+1 columns:
P' diag( weights)P = I   .
The result is computed such that P[i,j] is the value of a polynomial of degree j-1 evaluated at the ith element of the vector.

The maximum number of nonzero orthogonal polynomials (r) that can be computed from the vector and the weights is the number of distinct values in the vector, ignoring any value associated with a zero weight.

The polynomial of maximum degree has degree of r-1. If the value of maxdegree exceeds r-1, then columns r+1, r+2,..., maxdegree+1 of the result are set to 0. In this case,
The statement below results in a matrix with 3 orthogonal columns:
```  orpol=orpol(1:5,2);

ORPOL         5 rows      3 cols    (numeric)

0.4472136 -0.632456 0.5345225
0.4472136 -0.316228 -0.267261
0.4472136         0 -0.534522
0.4472136 0.3162278 -0.267261
0.4472136 0.6324555 0.5345225
```
See "Acknowledgments" in the front of this book for authorship of the ORPOL function.

 Chapter Contents Previous Next Top