mp: Define a multivariate polynomial.

Description Usage Arguments Value Author(s) See Also Examples

Description

mp is a smart function which attempts to create a formal mpoly object from a character string containing the usual representation of a multivariate polynomial.

Usage

1
2
3
make_indeterminate_list(vars)

mp(string, varorder, stars_only = FALSE)

Arguments

vars

a character vector of indeterminates

string

a character string containing a polynomial, see examples

varorder

(optional) order of variables in string

stars_only

if you format your multiplications using asterisks, setting this to TRUE will reduce preprocessing time

Value

An object of class mpoly.

Author(s)

David Kahle david@kahle.io

See Also

mpoly()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
( m <- mp("x + y + x y") )
is.mpoly( m )
unclass(m)


mp("x + 2 y + x^2 y + x y z")
mp("x + 2 y + x^2 y + x y z", varorder = c("y", "z", "x"))

( ms <- mp(c("x + y", "2 x")) )
is.mpolyList(ms)


gradient( mp("x + 2 y + x^2 y + x y z") )
gradient( mp("(x + y)^10") )

# mp and the print methods are kinds of inverses of each other
( polys <- mp(c("x + y", "x - y")) )
strings <- print(polys, silent = TRUE)
strings
mp(strings)

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

Related to mp in mpoly...