poly2str: Print Polynomial

Description Usage Arguments Details Value Examples

View source: R/polynomials.R

Description

Print polynomial as a character string.

Usage

1
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").

Details

Simple string manipulation.

Value

Returns the usual string representing a polynomial in mathematics.

Examples

1
2
3
poly2str(c(0))
poly2str(c(1, -1, 1, -1, 1))
poly2str(c(0, 1e-6, 1e6), d = 2)

Example output

[1] "0"
[1] "1*x^4 - 1*x^3 + 1*x^2 - 1*x + 1"
[1] "1e-06*x^1 + 1e+06"

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