polytrans: Polynomial Transformations

View source: R/polynomials.R

polytrans, polygcfR Documentation

Polynomial Transformations

Description

Transform a polynomial, find a greatest common factor, or determine the multiplicity of a root.

Usage

polytrans(p, q)

polygcf(p, q, tol = 1e-12)

Arguments

p, q

vectors representing two polynomials.

tol

tolerance for coefficients to tolerate.

Details

Transforms polynomial p replacing occurences of x with another polynomial q in x.

Finds a greatest common divisor (or factor) of two polynomials. Determines the multiplicity of a possible root; returns 0 if not a root. This is in general only true to a certain tolerance.

Value

polytrans and polygcf return vectors representing polynomials. rootsmult returns a natural number (or 0).

Note

There are no such functions in Matlab or Octave.

See Also

polyval

Examples

# (x+1)^2 + (x+1) + 1
polytrans(c(1, 1, 1), c(1, 1))    #=> 1 3 3
polytrans(c(1, 1, 1), c(-1, -1))  #=> 1 1 1

p <- c(1,-1,1,-1,1)         #=>  x^4 - x^3 + x^2 - x + 1
q <- c(1,1,1)               #=>  x^2 + x + 1
polygcf(polymul(p, q), q)   #=>  [1] 1 1 1

p = polypow(c(1, -1), 6)    #=>  [1] 1  -6  15 -20  15  -6   1
rootsmult(p, 1)             #=>  [1] 6

pracma documentation built on Nov. 10, 2023, 1:14 a.m.