Ops.multipol: Arithmetic ops group methods for multipols

Description Usage Arguments Details Author(s) See Also Examples

Description

Allows arithmetic operators to be used for multivariate polynomials such as addition, multiplication, and integer powers.

Usage

1
2
3
4
5
6
7
## S3 method for class 'multipol'
Ops(e1, e2 = NULL)
mprod(...,  trim = TRUE , maxorder=NULL)
mplus(...,  trim = TRUE , maxorder=NULL)
 mneg(a,    trim = TRUE , maxorder=NULL)
  mps(a, b, trim = TRUE , maxorder=NULL)
 mpow(a, n, trim = TRUE , maxorder=NULL)

Arguments

e1,e2,a

Multipols; scalars coerced

b

Scalar

n

Integer power

...

Multipols

trim

Boolean, with default TRUE meaning to return a trim()-ed multipol and FALSE meaning not to trim

maxorder

Numeric vector indicating maximum orders of the output [that is, the highest power retained in the multivariate Taylor expansion about rep(0,d)]. Length-one input is recycled to length d; default value of NULL means to return the full result. More details given under taylor()

Details

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 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 trim or maxorder may be set. They are:

Addition and multiplication of multivariate polynomials is commutative and associative, to machine precision.

Author(s)

Robin K. S. Hankin

See Also

outer,trim,taylor

Examples

 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

multipol documentation built on May 30, 2017, 2:59 a.m.