File: factor_poly.Rd

package info (click to toggle)
r-cran-m2r 1.0.2%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 488 kB
  • sloc: cpp: 195; python: 59; sh: 14; makefile: 2
file content (67 lines) | stat: -rw-r--r-- 1,360 bytes parent folder | download | duplicates (2)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/factor_poly.R
\name{factor_poly}
\alias{factor_poly}
\alias{factor_poly.}
\title{Factor a polynomial}
\usage{
factor_poly(mpoly, code = FALSE)

factor_poly.(mpoly, code = FALSE, ...)
}
\arguments{
\item{mpoly}{a character parseable by \code{\link[=mp]{mp()}}, an
\code{mpoly} object, or a pointer to a polynomial in M2}

\item{code}{return only the M2 code? (default: \code{FALSE})}

\item{...}{...}
}
\value{
a named list with elements \code{factor} (an
\code{mpolyList} object) and \code{power}, an integer
vector
}
\description{
Factor a polynomial
}
\examples{

\dontrun{ 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)

}
}