Skip to content

Commit d62ae9a

Browse files
committed
adds cyclic.jl
1 parent 926389c commit d62ae9a

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/examples/cyclic.jl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
@doc Markdown.doc"""
2+
cyclic(R::MPolyRing)
3+
4+
Return the Cyclic ideal in the variables of `R`.
5+
6+
# Example
7+
```jldoctest
8+
julia> using AlgebraicSolving
9+
10+
julia> R, vars = PolynomialRing(QQ, ["x$i" for i in 1:4])
11+
(Multivariate polynomial ring in 4 variables over QQ, Nemo.QQMPolyRingElem[x1, x2, x3, x4])
12+
13+
julia> cyclic(R)
14+
Nemo.QQMPolyRingElem[x1 + x2 + x3 + x4, x1*x2 + x1*x4 + x2*x3 + x3*x4, x1*x2*x3 + x1*x2*x4 + x1*x3*x4 + x2*x3*x4, x1*x2*x3*x4 - 1]
15+
```
16+
"""
17+
function cyclic(R::MPolyRing)
18+
vars = gens(R)
19+
n = length(vars)
20+
pols = [sum(prod(vars[j%n+1] for j in k:k+i) for k in 1:n) for i in 0:n-2]
21+
push!(pols, prod(vars[i] for i in 1:n)-1)
22+
return Ideal(pols)
23+
end

0 commit comments

Comments
 (0)