Learn R Programming

control (version 0.2.5)

poly2str: Print Polynomial

Description

Print polynomial as a character string.

Usage

poly2str(p, svar = "x", smul = "*", d = options("digits")$digits)

Arguments

p

numeric vector representing a polynomial

svar

character representing the unknown, default x.

smul

multiplication symbol, default *.

d

significant digits, default options("digits").

Value

Returns the usual string representing a polynomial in mathematics.

Details

Modified from package *pracma*. Modification: To hide any coefficient and power that is equal to 1 So that instead of '1s^3' we have 's^3' and instead of 's^1', we have 's'

Examples

Run this code
# NOT RUN {
poly2str(c(2, -3, 1, 20, -11))

# }

Run the code above in your browser using DataLab