polyMatrix-class: A class to represent matrix of polinomials

Description Usage Arguments Methods (by generic) Slots Examples

Description

A class to represent matrix of polinomials

Usage

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
## S4 method for signature 'polyMatrix,numeric'
x[[i]]

## S4 method for signature 'polyMatrix'
det(x)

## S4 method for signature 'polyMatrix'
nrow(x)

## S4 method for signature 'polynomial'
nrow(x)

## S4 method for signature 'polyMatrix'
ncol(x)

## S4 method for signature 'polynomial'
ncol(x)

## S4 method for signature 'polyMatrix'
dim(x)

## S4 method for signature 'polyMatrix'
predict(object, newdata)

## S4 method for signature 'polyMatrix'
round(x, digits = 0)

## S4 method for signature 'polyMatrix'
show(object)

## S4 method for signature 'polyMatrix,missing,missing,missing'
x[i, j, ..., drop = TRUE]

## S4 method for signature 'polyMatrix,missing,ANY,missing'
x[i, j]

## S4 method for signature 'polyMatrix,ANY,missing,missing'
x[i, j]

## S4 method for signature 'polyMatrix,logical,logical,missing'
x[i, j]

## S4 method for signature 'polyMatrix,logical,numeric,missing'
x[i, j]

## S4 method for signature 'polyMatrix,numeric,logical,missing'
x[i, j]

## S4 method for signature 'polyMatrix,numeric,numeric,missing'
x[i, j]

## S4 replacement method for signature 'polyMatrix,missing,missing,ANY'
x[i, j] <- value

## S4 replacement method for signature 'polyMatrix,missing,ANY,ANY'
x[i, j] <- value

## S4 replacement method for signature 'polyMatrix,ANY,missing,ANY'
x[i, j] <- value

## S4 replacement method for signature 'polyMatrix,numeric,numeric,numeric'
x[i, j] <- value

## S4 replacement method for signature 'polyMatrix,numeric,numeric,matrix'
x[i, j] <- value

## S4 replacement method for signature 'polyMatrix,numeric,numeric,polynomial'
x[i, j] <- value

## S4 replacement method for signature 'polyMatrix,numeric,numeric,polyMatrix'
x[i, j] <- value

## S4 method for signature 'polyMatrix,missing'
e1 + e2

## S4 method for signature 'polyMatrix,polyMatrix'
e1 + e2

## S4 method for signature 'polyMatrix,polynomial'
e1 + e2

## S4 method for signature 'polyMatrix,numeric'
e1 + e2

## S4 method for signature 'polyMatrix,matrix'
e1 + e2

## S4 method for signature 'ANY,polyMatrix'
e1 + e2

## S4 method for signature 'polyMatrix,polyMatrix'
e1 == e2

## S4 method for signature 'polyMatrix,polynomial'
e1 == e2

## S4 method for signature 'polyMatrix,matrix'
e1 == e2

## S4 method for signature 'polyMatrix,numeric'
e1 == e2

## S4 method for signature 'ANY,polyMatrix'
e1 == e2

## S4 method for signature 'polyMatrix,ANY'
e1 != e2

## S4 method for signature 'ANY,polyMatrix'
e1 != e2

## S4 method for signature 'polyMatrix,polyMatrix'
x %*% y

## S4 method for signature 'polyMatrix,matrix'
x %*% y

## S4 method for signature 'matrix,polyMatrix'
x %*% y

## S4 method for signature 'polyMatrix,numeric'
e1 * e2

## S4 method for signature 'polyMatrix,polynomial'
e1 * e2

## S4 method for signature 'polyMatrix,polyMatrix'
e1 * e2

## S4 method for signature 'ANY,polyMatrix'
e1 * e2

## S4 method for signature 'polyMatrix,polyMatrix'
e1 - e2

## S4 method for signature 'polyMatrix,ANY'
e1 - e2

## S4 method for signature 'ANY,polyMatrix'
e1 - e2

Arguments

x

an matrix object

i

the degree to extract matrix of coefficient

object

an R object

newdata

the value to evaluate

digits

integer indicating the number of decimal places (round) or significant digits (signif) to be used

j

column indeces

...

unused

drop

unused

value

new value

e1

an left operand

e2

an right operand

y

second argument

Methods (by generic)

Slots

coef

A matrix of coefficients which are joined into one matrix from lower degree to higher

ncol

Actual number of columns in the polynomial matrix

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# create a new polynomial matrix by parsing strings
pm <- parse.polyMatrix(
     "x; 1 + x^2; 3 x - x^2",
     "1; 1 + x^3; - x + x^3"
)

# get coefficient matrix for degree 0
pm[[0]]
##      [,1] [,2] [,3]
## [1,]    0    1    0
## [2 ]    1    1    0
# get coefficient matrix for degree 1
pm[[1]]
##      [,1] [,2] [,3]
## [1,]    1    0    3
## [2 ]    0    0   -1


# dimensions
nrow(pm) ## 2


ncol(pm) ## 3


dim(pm) ## [1] 2 3


# round
round(parse.polyMatrix(
  "      1.0001 - x,            1 - x^2, 1 + 2.0003*x + x^2",
  "0.0001 + x - x^2, 1 + x + 0.0001 x^2, 1 - 2*x + x^2"
))
##           [,1]      [,2]           [,3]
## [1,]     1 - x   1 - x^2   1 + 2x + x^2
## [2,]   x - x^2     1 + x   1 - 2x + x^2


# print out a polynomial matrix
show(parse.polyMatrix(
  "      1.0001 - x,          1 - x^2, 1 + 2.0003*x + x^2",
  "0.0001 + x - x^2,            1 + x, 1 - 2*x + x^2",
  "        12.3 x^3,  2 + 3.5 x + x^4, -0.7 + 1.6e-3 x^3"
))
##                   [,1]             [,2]                [,3]
## [1,]        1.0001 - x          1 - x^2   1 + 2.0003x + x^2
## [2,]   1e-04 + x - x^2            1 + x        1 - 2x + x^2
## [3,]           12.3x^3   2 + 3.5x + x^4    -0.7 + 0.0016x^3

namezys/polymatrix documentation built on July 18, 2021, 11:15 p.m.