constant {multipol} | R Documentation |
Various useful multivariate polynomials
Description
Various useful multivariate polynomials such as homogeneous polynomials, linear polynomials, etc
Usage
constant(d)
product(x)
homog(d, n = d, value = 1)
linear(x, power = 1)
lone(d,x)
single(d, e, power = 1)
uni(d)
zero(d)
Arguments
d |
Integer giving the dimensionality (arity) of the result |
x |
A vector of integers |
n , e , power |
Integers |
value |
Value for linear multivariate polynomial |
Details
In the following, all multipols have their nonzero entries 1 unless otherwise stated.
Function
constant(d)
returns the constant multivariate polynomial of arityd
Function
product(x)
returns a multipol of aritylength(x)
whereall(dim(product(x))==x)
with all zero entries except the one corresponding to\prod_{i=1}^d {x_i}^{x[i]}
Function
homog(d,n)
returns the homogeneous multipol of arityd
and powern
. The coeffients are set tovalue
(default 1); standard recycling is usedFunction
linear(x)
returns a multipol of aritylength(x)
which is linear in all its arguments and whose coefficients are the elements ofx
. Argumentpower
returns an equivalent multipol linear inx^power
Function
lone(d,x)
returns a multipol of arityd
that is a product of variablesx[i]
Function
single(d,e,power)
returns a multipol of arityd
with a single nonzero entry corresponding to dimensione
raised to the powerpower
Function
uni(d)
returnsx1*x2*...*xd
[it is a convenience wrapper forproduct(rep(1,d))
]Function
zero(d)
returns the zero multipol of arityd
[it is a convenience wrapper for0*constant(d)
]Function
ones(d)
returnsx1+x2+...+xd
[it is a convenience wrapper forlinear(rep(1,d))
]
Note
In many ways, the functions documented in this section are an adverisement for the inefficiency of dealing with multipols using arrays: sparse arrays would be the natural solution.
Author(s)
Robin K. S. Hankin
See Also
Examples
product(c(1,2,5)) # x * y^2 * z^5
uni(3) # xyz
single(3,1) # x
single(3,2) # y
single(3,3) # z
single(3,1,6) # x^6
single(3,2,6) # y^6
lone(3,1:2) # xy
lone(3,c(1,3)) # xz
linear(c(1,2,5)) # x + 2y + 5z
ones(3) # x+y+z
constant(3) # 1 + 0x + 0y + 0z
zero(3) # 0 + 0x + 0y + 0z
homog(3,2) # x^2 + y^2 + z^2 + xy + xz + yz
# now some multivariate factorization:
ones(2)*linear(c(1,-1)) # x^2-y^2
ones(2)*(linear(c(1,1),2)-uni(2)) # x^3+y^3
linear(c(1,-1))*homog(2,2) # x^3+y^3 again
ones(2)*(ones(2,4)+uni(2)^2-product(c(1,3))-product(c(3,1))) # x^5+y^5
ones(2)*homog(2,4,c(1,-1,1,-1,1)) # x^5+y^5 again