print.mpoly: Pretty printing of multivariate polynomials.

Description Usage Arguments Value Examples

View source: R/print.mpoly.R

Description

This is the major function used to view multivariate polynomials.

Usage

1
2
3
## S3 method for class 'mpoly'
print(x, varorder, order, stars = FALSE, silent =
  FALSE, ..., plus_pad = 2L, times_pad = 1L)

Arguments

x

an object of class mpoly

varorder

the order of the variables

order

a total order used to order the monomials in the printing

stars

print the multivariate polynomial in the more computer-friendly asterisk notation (default FALSE)

silent

logical; if TRUE, suppresses output

...

additional parameters to go to base::cat()

plus_pad

number of spaces to the left and right of plus sign

times_pad

number of spaces to the left and right of times sign

Value

Invisible string of the printed object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
mp("-x^5 - 3 y^2 + x y^3 - 1")


(p <- mp("2 x^5  -  3 y^2  +  x y^3"))
print(p) # same
print(p, silent = TRUE)
s <- print(p, silent = TRUE)
s

print(p, order = "lex") # -> 2 x^5  +  x y^3  -  3 y^2
print(p, order = "lex", varorder = c("y","x")) # -> y^3 x  -  3 y^2  +  2 x^5
print(p, varorder = c("y","x")) # -> y^3 x  -  3 y^2  +  2 x^5

# this is mostly used internally
print(p, stars = TRUE)
print(p, stars = TRUE, times_pad = 0L)
print(p, stars = TRUE, times_pad = 0L, plus_pad = 1L)
print(p, stars = TRUE, times_pad = 0L, plus_pad = 0L)
print(p, plus_pad = 1L)

mpoly documentation built on March 26, 2020, 7:33 p.m.