Description Usage Arguments Details Note Examples
View source: R/spray_extension.R
Increase the arity of a spray object by adding new columns (with zeros) to the index matrix of the spray object.
1 | increase_arity(S, position)
|
S |
spray object that shall have a new arity |
position |
column indexes where to add new variables |
The arity of a spray object defines the dimension of the polynomial. For
example lone(1, 2)
and lone(1, 5)
look the same when printed to
the console, but differ in their arity (2 or 5). This can be seen by using
method print_spray_matrixform
. Calculation with spray
objects (sum, product etc.) is only possible if the spray objects havte the
same arity. This is where function increase_arity
comes into play. It
can increase the arity of a polynomial/spray object by adding new variables.
This means essentially inserting new columns with zeros in the index matrix
of the spray object. The argument position
defines the columnindex
of these additinoal columns.
If S
is the NULL polynomial without a given arity (this can
arise for example by using method subs
), the returned
spray object will be the NULL polynomial with its arity given as the maximal
entry in vector positions
.
1 2 3 4 5 6 7 8 9 10 11 12 13 | library(spray)
lone(1, 5) + lone(1, 2) # throws error
lone(1, 5) + increase_arity(lone(1, 2), 3:5)
print_spray_matrixform(homog(2, 3))
s <- increase_arity(homog(2, 3), 2) # insert variable in the middle
print_spray_matrixform(s)
p <- subs(product(1:4), dims = 2:3, x = c(-1, 2)) # substitute values
increase_arity(p, 2:3) # keep arity as before the substitution
q <- subs(lone(1,1), 1, 0) # NULL polynomial without arity
increase_arity(q, c(2, 5))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.