Allows arithmetic operators to be used for multivariate polynomials such as addition, multiplication, and integer powers.
1 2 3 4 5 6 7 
e1,e2,a 
Multipols; scalars coerced 
b 
Scalar 
n 
Integer power 
... 
Multipols 
trim 
Boolean, with default 
maxorder 
Numeric vector indicating maximum orders of the output
[that is, the highest power retained in the multivariate Taylor
expansion about 
The function Ops.multipol()
passes unary and binary arithmetic
operators (“+
”, “
”, “*
”, and
“^
”) to the appropriate specialist function.
In multipol.R
, these specialist functions all have formal names
such as .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 convenientlynamed functions are provided in the package for the
enduser; these offer greater control than the arithmetic commandline
operations in that arguments trim
or 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
outer
,trim
,taylor
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

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.