polyadd: Adding Polynomials

Description Usage Arguments Details Value Note See Also Examples

View source: R/polynomials.R

Description

Add two polynomials given as vectors.

Usage

1
  polyadd(p, q)

Arguments

p, q

Vectors representing two polynomials.

Details

Polynomial addition realized simply by multiplying and summing up all the coefficients after extending vectors to the same length.

Value

Vector representing a polynomial.

Note

There is no such function in Matlab or Octave.

See Also

conv

Examples

1
2
3
polyadd(c(1, 1, 1), 1)
polyadd(c(1, 1, 1), c(0, 0, 1))
polyadd(c(-0.5, 1, -1), c(0.5, 0, 1))

Example output

[1] 1 1 2
[1] 1 1 2
[1] 1 0

pracma documentation built on Dec. 11, 2021, 9:57 a.m.