factor_poly: Factor a polynomial

Description Usage Arguments Value Examples

Description

Factor a polynomial

Usage

1
2
3
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
## 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)


## End(Not run)

coneill-math/m2r documentation built on May 28, 2020, 12:30 p.m.