Various useful multivariate polynomials

Description

Various useful multivariate polynomials such as homogeneous polynomials, linear polynomials, etc

Usage

1
2
3
4
5
6
7
8
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 arity d

  • Function product(x) returns a multipol of arity length(x) where all(dim(product(x))==x) with all zero entries except the one corresponding to xi^x[i]

  • Function homog(d,n) returns the homogeneous multipol of arity d and power n. The coeffients are set to value (default 1); standard recycling is used

  • Function linear(x) returns a multipol of arity length(x) which is linear in all its arguments and whose coefficients are the elements of x. Argument power returns an equivalent multipol linear in x^power

  • Function lone(d,x) returns a multipol of arity d that is a product of variables x[i]

  • Function single(d,e,power) returns a multipol of arity d with a single nonzero entry corresponding to dimension e raised to the power power

  • Function uni(d) returns x1*x2*...*xd [it is a convenience wrapper for product(rep(1,d))]

  • Function zero(d) returns the zero multipol of arity d [it is a convenience wrapper for 0*constant(d)]

  • Function ones(d) returns x1+x2+...+xd [it is a convenience wrapper for linear(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

outer,product,is.constant

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
  

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.