Allows arithmetic operators to be used for multivariate polynomials such as addition, multiplication, and integer powers.
1 2 3 4 5 6 7
Multipols; scalars coerced
Boolean, with default
Numeric vector indicating maximum orders of the output
[that is, the highest power retained in the multivariate Taylor
Ops.multipol() passes unary and binary arithmetic
^”) to the appropriate specialist function.
multipol.R, these specialist functions all have formal names
.multipol.prod.scalar() which follow a rigorous
pattern; they are not intended for the end user. They are not
exported from the namespace as they begin with a dot.
Five conveniently-named functions are provided in the package for the
end-user; these offer greater control than the arithmetic command-line
operations in that arguments
maxorder may be
set. They are:
mprod() for products,
mplus() for addition,
mneg() for the negative,
mps() for adding a scalar,
mpow() for powers.
Addition and multiplication of multivariate polynomials is commutative and associative, to machine precision.
Robin K. S. Hankin
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
a <- as.multipol(matrix(1,4,5)) 100+a f <- as.function(a+1i) f(5:6) b <- as.multipol(array(rnorm(12),c(2,3,2))) f1 <- as.function(b) f2 <- as.function(b*b) f3 <- as.function(b^3) # could have said b*b*b x <- c(1,pi,exp(1)) f1(x)^2 - f2(x) #should be zero f1(x)^3 - f3(x) #should be zero x1 <- as.multipol(matrix(1:10,ncol=2)) x2 <- as.multipol(matrix(1:10,nrow=2)) x1+x2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.