Title: | Multivariate Polynomials with Symbolic Parameters in their Coefficients |
---|---|
Description: | Introduces the 'symbolicQspray' objects. Such an object represents a multivariate polynomial whose coefficients are fractions of multivariate polynomials with rational coefficients. The package allows arithmetic on such polynomials. It is based on the 'qspray' and 'ratioOfQsprays' packages. Some functions for 'qspray' polynomials have their counterpart for 'symbolicQspray' polynomials. A 'symbolicQspray' polynomial should not be seen as a polynomial on the field of fractions of rational polynomials, but should rather be seen as a polynomial with rational coefficients depending on some parameters, symbolically represented, with a dependence given by fractions of rational polynomials. |
Authors: | Stéphane Laurent [aut, cre] |
Maintainer: | Stéphane Laurent <[email protected]> |
License: | GPL-3 |
Version: | 1.1.0 |
Built: | 2024-11-26 06:50:32 UTC |
Source: | CRAN |
Coercion to a 'symbolicQspray' object
## S4 method for signature 'character' as.symbolicQspray(x) ## S4 method for signature 'qspray' as.symbolicQspray(x) ## S4 method for signature 'ratioOfQsprays' as.symbolicQspray(x) ## S4 method for signature 'symbolicQspray' as.symbolicQspray(x) ## S4 method for signature 'numeric' as.symbolicQspray(x) ## S4 method for signature 'bigz' as.symbolicQspray(x) ## S4 method for signature 'bigq' as.symbolicQspray(x)
## S4 method for signature 'character' as.symbolicQspray(x) ## S4 method for signature 'qspray' as.symbolicQspray(x) ## S4 method for signature 'ratioOfQsprays' as.symbolicQspray(x) ## S4 method for signature 'symbolicQspray' as.symbolicQspray(x) ## S4 method for signature 'numeric' as.symbolicQspray(x) ## S4 method for signature 'bigz' as.symbolicQspray(x) ## S4 method for signature 'bigq' as.symbolicQspray(x)
x |
a |
A symbolicQspray
object.
as.symbolicQspray(2) as.symbolicQspray("1/3")
as.symbolicQspray(2) as.symbolicQspray("1/3")
Replaces the parameters of a symbolicQspray
polynomial
(which are qspray
objects) with some qspray
polynomials.
E.g. you have a polynomial with two parameters and you
want the polynomial
(see example).
changeParameters(Qspray, newParameters)
changeParameters(Qspray, newParameters)
Qspray |
a |
newParameters |
a list containing at least |
The symbolicQspray
polynomial obtained by replacing the
parameters of the symbolic polynomial given in the Qspray
argument
with the polynomials given in the newParameters
argument.
If you want to change the variables of a symbolic qspray, use
changeVariables
. If you want to assign some values to
its parameters, use substituteParameters
.
library(symbolicQspray) ( JP <- JacobiPolynomial(2) ) # a univariate polynomial with two parameters a1 <- qlone(1) a2 <- qlone(2) changeParameters(JP, list(a1, a2)) == JP # should be TRUE changeParameters(JP, list(a1+1, a2+1))
library(symbolicQspray) ( JP <- JacobiPolynomial(2) ) # a univariate polynomial with two parameters a1 <- qlone(1) a2 <- qlone(2) changeParameters(JP, list(a1, a2)) == JP # should be TRUE changeParameters(JP, list(a1+1, a2+1))
Replaces the variables of a symbolicQspray
polynomial
with some symbolicQspray
polynomials. E.g. you have a polynomial
and you want the polynomial
(see
example).
## S4 method for signature 'symbolicQspray,list' changeVariables(x, listOfQsprays)
## S4 method for signature 'symbolicQspray,list' changeVariables(x, listOfQsprays)
x |
a |
listOfQsprays |
a list containing at least |
The symbolicQspray
polynomial obtained by replacing the
variables of the polynomial given in the x
argument with the
polynomials given in the listOfQsprays
argument.
If you want to change the parameters of a symbolic qspray, use
changeParameters
. If you want to assign some values to
its variables, see substituteVariables
.
library(symbolicQspray) f <- function(a, X, Y) { a^2 / (a + 1) * X^2*Y + (3*a - 2) / a * Y^2 } a <- qlone(1) X <- Qlone(1) Y <- Qlone(2) Qspray <- f(a, X, Y) U <- X + a V <- Y + a changeVariables(Qspray, list(U, V)) == f(a, U, V) # should be TRUE
library(symbolicQspray) f <- function(a, X, Y) { a^2 / (a + 1) * X^2*Y + (3*a - 2) / a * Y^2 } a <- qlone(1) X <- Qlone(1) Y <- Qlone(2) Qspray <- f(a, X, Y) U <- X + a V <- Y + a changeVariables(Qspray, list(U, V)) == f(a, U, V) # should be TRUE
Prints a symmetric symbolicQspray
polynomial as a linear
combination of the monomial symmetric polynomials.
## S4 method for signature 'symbolicQspray,logical' compactSymmetricQspray(qspray, check) ## S4 method for signature 'symbolicQspray,missing' compactSymmetricQspray(qspray, check)
## S4 method for signature 'symbolicQspray,logical' compactSymmetricQspray(qspray, check) ## S4 method for signature 'symbolicQspray,missing' compactSymmetricQspray(qspray, check)
qspray |
a |
check |
Boolean, whether to check the symmetry |
A character string.
Partial derivative of a symbolicQspray
polynomial.
derivSymbolicQspray(Qspray, i, derivative = 1)
derivSymbolicQspray(Qspray, i, derivative = 1)
Qspray |
object of class |
i |
integer, the dimension to differentiate with respect to, e.g.
|
derivative |
positive integer, how many times to differentiate |
A symbolicQspray
object.
Partial differentiation of a symbolicQspray
polynomial.
dSymbolicQspray(Qspray, orders)
dSymbolicQspray(Qspray, orders)
Qspray |
object of class |
orders |
integer vector, the orders of the differentiation; e.g.
|
A symbolicQspray
object.
Evaluates a symbolicQspray
polynomial by substituting
some values to the parameters (same as substituteParameters
)
or to the variables (same as substituteVariables
) or both.
evalSymbolicQspray(Qspray, a = NULL, X = NULL)
evalSymbolicQspray(Qspray, a = NULL, X = NULL)
Qspray |
a |
a |
vector of values to be substituted to the parameters;
these values must be coercible to |
X |
vector of values to be substituted to the variables; these
values must be coercible to |
If both a
and X
are NULL
, this returns the
input symbolicQspray
object; otherwise, if a
is not
NULL
, this returns a qspray
object, and if
X
is not NULL
, this returns a ratioOfQsprays
object.
library(symbolicQspray) a1 <- qlone(1); a2 <- qlone(2) X1 <- Qlone(1); X2 <- Qlone(2); X3 <- Qlone(3) ( Qspray <- (a1 + 2)*X1^2*X2 + (a2/(a1^2+a2))*X1*X2*X3 ) a <- c(2, 3) X <- c(4, 3, 2) ( qspray <- evalSymbolicQspray(Qspray, a = a) ) ( rOQ <- evalSymbolicQspray(Qspray, X = X) ) evalSymbolicQspray(Qspray, a = a, X = X) evalQspray(qspray, X) evalRatioOfQsprays(rOQ, a)
library(symbolicQspray) a1 <- qlone(1); a2 <- qlone(2) X1 <- Qlone(1); X2 <- Qlone(2); X3 <- Qlone(3) ( Qspray <- (a1 + 2)*X1^2*X2 + (a2/(a1^2+a2))*X1*X2*X3 ) a <- c(2, 3) X <- c(4, 3, 2) ( qspray <- evalSymbolicQspray(Qspray, a = a) ) ( rOQ <- evalSymbolicQspray(Qspray, X = X) ) evalSymbolicQspray(Qspray, a = a, X = X) evalQspray(qspray, X) evalRatioOfQsprays(rOQ, a)
Get the coefficient of the term with the given monomial.
## S4 method for signature 'symbolicQspray,numeric' getCoefficient(qspray, exponents)
## S4 method for signature 'symbolicQspray,numeric' getCoefficient(qspray, exponents)
qspray |
a |
exponents |
a vector of exponents, thereby defining a monomial; trailing zeros are ignored |
The coefficient, ratioOfQsprays
object.
a1 <- qlone(1); a2 <- qlone(2) X <- Qlone(1); Y <- Qlone(2) p <- 2*(a1/a2)*X^2 + (a1/(a1+a2))*Y + a2^2/a1 getCoefficient(p, 2) # coefficient of X^2 getCoefficient(p, c(2, 0)) # same as getCoefficient(p, 2) getCoefficient(p, c(0, 1)) # coefficient of Y (because Y=X^0.Y^1) getCoefficient(p, 0) # the constant term getCoefficient(p, 3) # coefficient of X^3
a1 <- qlone(1); a2 <- qlone(2) X <- Qlone(1); Y <- Qlone(2) p <- 2*(a1/a2)*X^2 + (a1/(a1+a2))*Y + a2^2/a1 getCoefficient(p, 2) # coefficient of X^2 getCoefficient(p, c(2, 0)) # same as getCoefficient(p, 2) getCoefficient(p, c(0, 1)) # coefficient of Y (because Y=X^0.Y^1) getCoefficient(p, 0) # the constant term getCoefficient(p, 3) # coefficient of X^3
Get the constant term of a symbolicQspray
polynomial.
## S4 method for signature 'symbolicQspray' getConstantTerm(qspray)
## S4 method for signature 'symbolicQspray' getConstantTerm(qspray)
qspray |
a |
A ratioOfQsprays
object.
Checks whether the dependence of the coefficients of a
symbolicQspray
polynomial on their parameters is polynomial.
hasPolynomialCoefficientsOnly(Qspray)
hasPolynomialCoefficientsOnly(Qspray)
Qspray |
a |
A Boolean value. The coefficients of a symbolicQspray
polynomial always are fractions of polynomials. This function checks
whether they are polynomials.
JP <- JacobiPolynomial(4) hasPolynomialCoefficientsOnly(JP)
JP <- JacobiPolynomial(4) hasPolynomialCoefficientsOnly(JP)
Variables involved in a symbolicQspray
object.
## S4 method for signature 'symbolicQspray' involvedVariables(x)
## S4 method for signature 'symbolicQspray' involvedVariables(x)
x |
a |
A vector of integers. Each integer represents the index of a
variable involved in x
.
a1 <- qlone(1); a2 <- qlone(2) X <- Qlone(1); Z <- Qlone(3) Qspray <- (a1/a2)*X^2 + (a1/(a1+a2))*X*Z + a2^2/a1 involvedVariables(Qspray) # should be c(1L, 3L)
a1 <- qlone(1); a2 <- qlone(2) X <- Qlone(1); Z <- Qlone(3) Qspray <- (a1/a2)*X^2 + (a1/(a1+a2))*X*Z + a2^2/a1 involvedVariables(Qspray) # should be c(1L, 3L)
Checks whether a symbolicQspray
object defines a constant
polynomial.
## S4 method for signature 'symbolicQspray' isConstant(x)
## S4 method for signature 'symbolicQspray' isConstant(x)
x |
a |
A Boolean value.
Checks whether a symbolicQspray
object defines the unit
polynomial.
## S4 method for signature 'symbolicQspray' isQone(qspray)
## S4 method for signature 'symbolicQspray' isQone(qspray)
qspray |
a |
A Boolean value.
Checks whether a symbolicQspray
object defines the zero
polynomial.
## S4 method for signature 'symbolicQspray' isQzero(qspray)
## S4 method for signature 'symbolicQspray' isQzero(qspray)
qspray |
a |
A Boolean value.
Checks whether a symbolicQspray
object defines a
univariate polynomial.
## S4 method for signature 'symbolicQspray' isUnivariate(x)
## S4 method for signature 'symbolicQspray' isUnivariate(x)
x |
a |
A Boolean value.
It is considered that a constant symbolicQspray
is univariate.
Computes the n-th Jacobi polynomial as a
symbolicQspray
.
JacobiPolynomial(n)
JacobiPolynomial(n)
n |
index (corresponding to the degree), a positive integer |
The Jacobi polynomials are univariate polynomials whose coefficients depend on two parameters.
A symbolicQspray
object representing the n-th Jacobi
polynomial.
JP1 <- JacobiPolynomial(1) showSymbolicQsprayOption(JP1, "showRatioOfQsprays") <- showRatioOfQspraysXYZ(c("alpha", "beta")) JP1
JP1 <- JacobiPolynomial(1) showSymbolicQsprayOption(JP1, "showRatioOfQsprays") <- showRatioOfQspraysXYZ(c("alpha", "beta")) JP1
Number of parameters of a symbolicQspray
polynomial,
i.e. the number of variables occurring in its coefficients.
numberOfParameters(Qspray)
numberOfParameters(Qspray)
Qspray |
a |
An integer, the number of parameters involved in (the
coefficients of) Qspray
.
JP <- JacobiPolynomial(4) # Jacobi polynomials have two parameters numberOfParameters(JP)
JP <- JacobiPolynomial(4) # Jacobi polynomials have two parameters numberOfParameters(JP)
Number of terms in the polynomial defined by a
symbolicQspray
object.
## S4 method for signature 'symbolicQspray' numberOfTerms(qspray)
## S4 method for signature 'symbolicQspray' numberOfTerms(qspray)
qspray |
a |
An integer.
Number of variables involved in a symbolicQspray
object.
## S4 method for signature 'symbolicQspray' numberOfVariables(x)
## S4 method for signature 'symbolicQspray' numberOfVariables(x)
x |
a |
An integer.
The number of variables in the symbolicQspray
object
Qlone(d)
is d
, not 1
.
Permute the variables of a symbolicQspray
polynomial.
## S4 method for signature 'symbolicQspray,numeric' permuteVariables(x, permutation)
## S4 method for signature 'symbolicQspray,numeric' permuteVariables(x, permutation)
x |
a |
permutation |
a permutation |
A symbolicQspray
object.
f <- function(a1, a2, X, Y, Z) { (a1^2 + 5*a2) / (a1 + 1) * X^2*Y + (3*a1 - a2) / a2 * Y^3 } a1 <- qlone(1) a2 <- qlone(2) X <- Qlone(1) Y <- Qlone(2) Z <- Qlone(3) Qspray <- f(a1, a2, X, Y, Z) perm <- c(3, 1, 2) permuteVariables(Qspray, perm) == f(a1, a2, Z, X, Y) # should be TRUE
f <- function(a1, a2, X, Y, Z) { (a1^2 + 5*a2) / (a1 + 1) * X^2*Y + (3*a1 - a2) / a2 * Y^3 } a1 <- qlone(1) a2 <- qlone(2) X <- Qlone(1) Y <- Qlone(2) Z <- Qlone(3) Qspray <- f(a1, a2, X, Y, Z) perm <- c(3, 1, 2) permuteVariables(Qspray, perm) == f(a1, a2, Z, X, Y) # should be TRUE
Creates a polynomial variable for a symbolicQspray
.
Qlone(n)
Qlone(n)
n |
positive integer, the index of the variable |
A symbolicQspray
object.
X <- Qlone(1) Y <- Qlone(2) (X + Y)^2 Qlone(0) == 1
X <- Qlone(1) Y <- Qlone(2) (X + Y)^2 Qlone(0) == 1
Returns the symbolicQspray
polynomial identically
equal to 1.
Qone()
Qone()
A symbolicQspray
object.
Returns the symbolicQspray
polynomial
identically equal to 0.
Qzero()
Qzero()
A symbolicQspray
object.
Generates a random symbolicQspray
object.
rSymbolicQspray()
rSymbolicQspray()
A symbolicQspray
object.
Prints a symbolicQspray
object given a function to print
a ratioOfQsprays
object.
showSymbolicQspray( showRatioOfQsprays, showMonomial, lbrace = "{ ", rbrace = " }", addition = " + ", multiplication = " * " )
showSymbolicQspray( showRatioOfQsprays, showMonomial, lbrace = "{ ", rbrace = " }", addition = " + ", multiplication = " * " )
showRatioOfQsprays |
a function which prints a |
showMonomial |
a function which prints a monomial, such as
|
lbrace , rbrace
|
used to enclose the coefficients |
addition |
used to separate the terms |
multiplication |
used to separate the coefficient and the monomial within a term |
A function which prints a symbolicQspray
object.
The function returned by this function is appropriate for usage in
showSymbolicQsprayOption<-
as the option
"showSymbolicQspray"
but in general we would rather
use showSymbolicQsprayX1X2X3
or
showSymbolicQsprayXYZ
, or rather set the options "a"
,
"X"
and "quotientBar"
.
showSymbolicQsprayX1X2X3
,
showSymbolicQsprayXYZ
.
set.seed(421) ( Qspray <- rSymbolicQspray() ) showRatioOfQsprays <- showRatioOfQspraysXYZ(c("a", "b", "c"), quotientBar = " / ") showMonomial <- showMonomialX1X2X3("X") f <- showSymbolicQspray(showRatioOfQsprays, showMonomial, "{{{", "}}}") f(Qspray) # setting a show option: showSymbolicQsprayOption(Qspray, "showSymbolicQspray") <- f Qspray # the show options are preserved by certain operations, e.g.: 2*Qspray
set.seed(421) ( Qspray <- rSymbolicQspray() ) showRatioOfQsprays <- showRatioOfQspraysXYZ(c("a", "b", "c"), quotientBar = " / ") showMonomial <- showMonomialX1X2X3("X") f <- showSymbolicQspray(showRatioOfQsprays, showMonomial, "{{{", "}}}") f(Qspray) # setting a show option: showSymbolicQsprayOption(Qspray, "showSymbolicQspray") <- f Qspray # the show options are preserved by certain operations, e.g.: 2*Qspray
Prints a symbolicQspray
object.
showSymbolicQsprayABCXYZ( params, vars = c("X", "Y", "Z"), quotientBar = " %//% ", ... )
showSymbolicQsprayABCXYZ( params, vars = c("X", "Y", "Z"), quotientBar = " %//% ", ... )
params |
vector of strings, usually some letters, to denote the parameters of the polynomial |
vars |
a vector of strings, usually some letters, to denote the variables of the polynomial |
quotientBar |
a string for the quotient bar between the numerator and
the denominator of a |
... |
arguments other than |
A function which prints symbolicQspray
objects.
This function is built by applying showSymbolicQspray
to
showRatioOfQspraysXYZ(params)
and
showMonomialXYZ(vars)
.
set.seed(421) ( Qspray <- rSymbolicQspray() ) showSymbolicQsprayABCXYZ(c("a", "b", "c"), c("U", "V"))(Qspray)
set.seed(421) ( Qspray <- rSymbolicQspray() ) showSymbolicQsprayABCXYZ(c("a", "b", "c"), c("U", "V"))(Qspray)
Set show option to a symbolicQspray
object
showSymbolicQsprayOption(x, which) <- value
showSymbolicQsprayOption(x, which) <- value
x |
a |
which |
which option to set; this can be |
value |
the value for the option |
This returns the updated symbolicQspray
.
set.seed(421) Qspray <- rSymbolicQspray() showSymbolicQsprayOption(Qspray, "a") <- "x" showSymbolicQsprayOption(Qspray, "X") <- "A" showSymbolicQsprayOption(Qspray, "quotientBar") <- " / " Qspray showSymbolicQsprayOption(Qspray, "showRatioOfQsprays") <- showRatioOfQspraysXYZ() Qspray
set.seed(421) Qspray <- rSymbolicQspray() showSymbolicQsprayOption(Qspray, "a") <- "x" showSymbolicQsprayOption(Qspray, "X") <- "A" showSymbolicQsprayOption(Qspray, "quotientBar") <- " / " Qspray showSymbolicQsprayOption(Qspray, "showRatioOfQsprays") <- showRatioOfQspraysXYZ() Qspray
Prints a symbolicQspray
object.
showSymbolicQsprayX1X2X3(a = "a", X = "X", quotientBar = " %//% ", ...)
showSymbolicQsprayX1X2X3(a = "a", X = "X", quotientBar = " %//% ", ...)
a |
a string, usually a letter, to denote the non-indexed variables
of the |
X |
a string, usually a letter, to denote the non-indexed variables |
quotientBar |
a string for the quotient bar between the numerator and
the denominator of a |
... |
arguments other than |
A function which prints symbolicQspray
objects.
This function is built by applying showSymbolicQspray
to
showRatioOfQspraysX1X2X3(a)
and
showMonomialX1X2X3(X)
.
set.seed(421) Qspray <- rSymbolicQspray() showSymbolicQsprayX1X2X3(quotientBar = " / ")(Qspray)
set.seed(421) Qspray <- rSymbolicQspray() showSymbolicQsprayX1X2X3(quotientBar = " / ")(Qspray)
Prints a symbolicQspray
object.
showSymbolicQsprayXYZ( a = "a", letters = c("X", "Y", "Z"), quotientBar = " %//% ", ... )
showSymbolicQsprayXYZ( a = "a", letters = c("X", "Y", "Z"), quotientBar = " %//% ", ... )
a |
a string, usually a letter, to denote the non-indexed variables
of the |
letters |
a vector of strings, usually some letters, to denote the variables of the polynomial |
quotientBar |
a string for the quotient bar between the numerator and
the denominator of a |
... |
arguments other than |
A function which prints symbolicQspray
objects.
This function is built by applying showSymbolicQspray
to
showRatioOfQspraysX1X2X3(a)
and
showMonomialXYZ(letters)
.
set.seed(421) Qspray <- rSymbolicQspray() showSymbolicQsprayX1X2X3(quotientBar = " / ")(Qspray)
set.seed(421) Qspray <- rSymbolicQspray() showSymbolicQsprayX1X2X3(quotientBar = " / ")(Qspray)
Substitutes some values to the parameters of a
symbolicQspray
polynomial.
substituteParameters(Qspray, values)
substituteParameters(Qspray, values)
Qspray |
a |
values |
vector of values to be substituted to the parameters; these
values must be coercible to |
A qspray
object.
Use changeParameters
to apply a transformation of the
parameters. Use substituteVariables
to substitute some
values to the variables.
library(symbolicQspray) f <- function(a1, a2, X, Y) { (a1 + 2)*X^2*Y + (a2/(a1^2+a2))*X*Y } Qspray <- f(qlone(1), qlone(2), Qlone(1), Qlone(2)) a <- c(2, "2/3") ( qspray <- substituteParameters(Qspray, values = a) ) a <- gmp::as.bigq(a) qspray == f(a[1], a[2], qlone(1), qlone(2)) ## should be TRUE
library(symbolicQspray) f <- function(a1, a2, X, Y) { (a1 + 2)*X^2*Y + (a2/(a1^2+a2))*X*Y } Qspray <- f(qlone(1), qlone(2), Qlone(1), Qlone(2)) a <- c(2, "2/3") ( qspray <- substituteParameters(Qspray, values = a) ) a <- gmp::as.bigq(a) qspray == f(a[1], a[2], qlone(1), qlone(2)) ## should be TRUE
Substitutes some values to the variables of a
symbolicQspray
polynomial.
substituteVariables(Qspray, values)
substituteVariables(Qspray, values)
Qspray |
a |
values |
vector of values to be substituted to the variables; these
values must be coercible to |
A ratioOfQsprays
object.
Use changeVariables
to apply a transformation of the
variables. Use substituteParameters
to substitute some
values to the parameters.
library(symbolicQspray) f <- function(a1, a2, X, Y) { (a1 + 2)*X^2*Y + (a2/(a1^2+a2))*X*Y } a1 <- qlone(1); a2 <- qlone(2) Qspray <- f(a1, a2, Qlone(1), Qlone(2)) values <- c(3, "2/3") ( rOQ <- substituteVariables(Qspray, values) ) values <- gmp::as.bigq(values) rOQ == f(a1, a2, values[1], values[2]) ## should be TRUE
library(symbolicQspray) f <- function(a1, a2, X, Y) { (a1 + 2)*X^2*Y + (a2/(a1^2+a2))*X*Y } a1 <- qlone(1); a2 <- qlone(2) Qspray <- f(a1, a2, Qlone(1), Qlone(2)) values <- c(3, "2/3") ( rOQ <- substituteVariables(Qspray, values) ) values <- gmp::as.bigq(values) rOQ == f(a1, a2, values[1], values[2]) ## should be TRUE
Swap two variables of a symbolicQspray
.
## S4 method for signature 'symbolicQspray,numeric,numeric' swapVariables(x, i, j)
## S4 method for signature 'symbolicQspray,numeric,numeric' swapVariables(x, i, j)
x |
a |
i , j
|
indices of the variables to be swapped |
A symbolicQspray
object.
library(symbolicQspray) f <- function(a1, a2, X, Y, Z) { (a1^2 + 5*a2) / (a1 + 1) * X^2*Y + (3*a1 - a2) / a2 * Y^3 } a1 <- qlone(1) a2 <- qlone(2) X <- Qlone(1) Y <- Qlone(2) Z <- Qlone(3) Qspray <- f(a1, a2, X, Y, Z) swapVariables(Qspray, 2, 3) == f(a1, a2, X, Z, Y) # should be TRUE
library(symbolicQspray) f <- function(a1, a2, X, Y, Z) { (a1^2 + 5*a2) / (a1 + 1) * X^2*Y + (3*a1 - a2) / a2 * Y^3 } a1 <- qlone(1) a2 <- qlone(2) X <- Qlone(1) Y <- Qlone(2) Z <- Qlone(3) Qspray <- f(a1, a2, X, Y, Z) swapVariables(Qspray, 2, 3) == f(a1, a2, X, Z, Y) # should be TRUE
This function is for internal usage. It is exported because it is also used for internal usage in others packages.
symbolicQspray_from_list(x)
symbolicQspray_from_list(x)
x |
list returned by the Rcpp function
|
A symbolicQspray
object.
Unary operators for symbolicQspray
objects.
## S4 method for signature 'symbolicQspray,missing' e1 + e2 ## S4 method for signature 'symbolicQspray,missing' e1 - e2
## S4 method for signature 'symbolicQspray,missing' e1 + e2 ## S4 method for signature 'symbolicQspray,missing' e1 - e2
e1 |
object of class |
e2 |
nothing |
A symbolicQspray
object.