a vector of coefficients, one for each term of p(x)
k
a matrix of (non-negative, integer) powers
p
a polynomial, defined by definePoly
num.digits
number of digits to print for the coefficients of the polynomial
x
a (n x m) matrix, with columns containing the vectors where the polynomial should be evaluated
useTerm
vector of boolean values: if useTerm[i]=TRUE, term i is included in the evaluation;
if useTerm[i]=FALSE, term i is not included.
Value
For definePoly, a list is returned. That list can be used by integrateSimplexPolynomial, printPoly,
or evalPoly.
For printPoly, nothing is returned, but a human readable format is printed on the console.
For evalPoly, a vector of m values: y[i] = p(x[,i]).
Details
These are utility functions for use with integrateSimplexPolynomial. definePoly is used to
define a polynomial:
$$p(x)=\sum_{i=1}^{\mathrm{length(coef)}} \mathrm{coef}_i x_1^{k[i,1]} x_2^{k[i,2]}
\cdots x_n^{k[i,n]} $$
printPoly prints a polynomial in human readable form.
evalPoly evaluates a polynomial at each of the vectors x[,1],x[,2],...,x[,m].
The optional argument useTerm is for internal use.