g_linrecur(G;S;O;T;N;X;M;K)
Multivariate linear recurrence relations of arbitrary order
Syntax
g_linrecur(G;S;O;T;N;X;M;K)
Input
| Argument | Type | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
G |
any | A space- or comma-separated list of column names Rows are in the same group
if their values for all of the columns listed in If If any of the columns listed in |
||||||||
S |
integer | The name of a column in which every row evaluates to a 1 or 0, which determines
whether or not that row is selected to be included in the calculation If
If any of the values in
|
||||||||
O |
integer | A space- or comma-separated list of column names that
determine the row order within a particular group If
If any of the values in |
||||||||
T |
integer | A column name
If present, T
must be (within each group) a non-decreasing sequence of integers greater than or
equal to zero. For example: 1,2,3,4... or 0,1,4,5,5,6,7...
If the sequence begins with a value less than the order of the relation (e.g.,
0 for a first-order relation, 0 or
1 for a second-order, etc.), then the results for those
times are copied from the seed values If
|
||||||||
N |
integer | A scalar value
|
||||||||
X |
integer or decimal | A space- or comma-separated list of either
scalar values or column names
Each element is either a constant number or a numeric column. If it is a column, it should be the same for all values in the group (only the first value will be used). The first |
||||||||
M |
integer or decimal | A space- or comma-separated list of either
scalar values or column names
Each element is either a constant number or a numeric column (in which case, the value at each row is used). The first For an example, in the case of a second-order relation, two-variable relation, the list:
represents the two 2x2 matrices: B(1)=
B(2)=
|
||||||||
K |
integer or decimal | A space- or comma-separated list of either
scalar values or column names
If present, If
|
Return Value
For every row in each group defined by G (and for those rows where
S=1, if specified), g_linrecur
returns a special type representing a vector for each row in the table.
A linear recurrence relation on N variables is computed for each
group. The initial (seed) values for the relation are set by X, with the
order of the relation being fixed by the number of elements in X, and at
each time step (specified by T), the next value is calculated. The result
of the function is a special vector type (N elements) that can be
decomposed into the values of the individual variables with the select(V;I)
function.
At time step T >= D, the vector value
R of this function is:
B(1)*R(T-D) +
B(2)*R(T-D+1) ..
+ B(D)*R(T-1) +
K
where the products are matrix products of the matrices B and the earlier values R of the function.
