m2r (version 1.0.2)

factor_poly: Factor a polynomial

Description

Factor a polynomial

Usage

factor_poly(mpoly, code = FALSE)

factor_poly.(mpoly, code = FALSE, ...)

Arguments

mpoly

a character parseable by mp(), an mpoly object, or a pointer to a polynomial in M2

code

return only the M2 code? (default: FALSE)

...

...

Value

a named list with elements factor (an mpolyList object) and power, an integer vector

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
 requires Macaulay2 be installed and an interactive session

##### basic usage
########################################

ring("x", "y", coefring = "QQ")
factor_poly("x^4 - y^4")

# reference function
factor_poly.("x^4 - y^4")


##### different inputs
########################################

# factor_poly accepts mpoly objects:
# remember you must create the ring first!
(p <- mp("x^4 - y^4"))
factor_poly.(p)
factor_poly(p)
mp("(x-y) (x+y) (x^2+y^2)")



##### other examples
########################################

ring("x","y", "z", coefring = "QQ")
(p <- mp("(x^2 - y) (x^2 + y) (x + y)^2 (x - z)^2"))
factor_poly.(p)
factor_poly(p)

(p <- mp("(x-1)^3 (y-1)^3"))
factor_poly.(p)
factor_poly(p)

# }

Run the code above in your browser using DataLab