Learn R Programming

symbolicQspray (version 1.1.0)

getCoefficient: Get a coefficient in a 'symbolicQspray' polynomial

Description

Get the coefficient of the term with the given monomial.

Usage

# S4 method for symbolicQspray,numeric
getCoefficient(qspray, exponents)

Value

The coefficient, ratioOfQsprays object.

Arguments

qspray

a symbolicQspray object

exponents

a vector of exponents, thereby defining a monomial; trailing zeros are ignored

Examples

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

Run the code above in your browser using DataLab