Learn R Programming

symbolicQspray (version 1.1.0)

swapVariables: Swap variables

Description

Swap two variables of a symbolicQspray.

Usage

# S4 method for symbolicQspray,numeric,numeric
swapVariables(x, i, j)

Value

A symbolicQspray object.

Arguments

x

a symbolicQspray object

i, j

indices of the variables to be swapped

Examples

Run this code
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

Run the code above in your browser using DataLab