change.origin(p, o)
p
| An object of class polynomial |
o
| A numeric scalar representing the new origin on the original scale |
Let P(x) = sum_i p_i x^i be a given polynomial and consider writing P(x) = sum_j q_j (x - o)^j. This function calculates the coefficients q_j and returns the result as a polynomial.
pr <- poly.from.zeros(1:5) pr ## -120 + 274*x - 225*x^2 + 85*x^3 - 15*x^4 + x^5 change.origin(pr, 3) ## 4*x - 5*x^3 - 10*x^4 + x^5