msolve
julia> using GroebnerBasis, Singular julia> R, (a, b, c) = PolynomialRing(QQ, ["a", "b", "c"]); julia> I(n) = Ideal(R, [(a+b)^n+c-3, (b+c)^n+a-2, (2*c+a)^n+b-1]); julia> for n = 5:15 print(n,":"); @time msolve(I(n), get_param = true) end; 5: 0.122010 seconds (11.82 k allocations: 1.950 MiB, 0.02% compilation time) 6: 0.348948 seconds (19.29 k allocations: 4.985 MiB, 0.01% compilation time) 7: 0.878888 seconds (27.93 k allocations: 11.589 MiB, 0.01% compilation time) 8: 2.193366 seconds (40.84 k allocations: 24.917 MiB, 0.00% compilation time) 9: 4.885550 seconds (57.68 k allocations: 49.346 MiB, 0.00% compilation time) 10: 11.550713 seconds (82.87 k allocations: 91.559 MiB, 0.06% gc time, 0.00% compilation time) 11: 23.599137 seconds (105.80 k allocations: 160.780 MiB, 0.00% compilation time) 12: 52.038471 seconds (139.22 k allocations: 269.434 MiB, 0.02% gc time, 0.00% compilation time) 13: 99.050393 seconds (253.12 k allocations: 453.029 MiB, 0.02% gc time, 0.10% compilation time) 14:202.253239 seconds (331.56 k allocations: 691.498 MiB, 0.10% gc time, 0.07% compilation time) 15:362.278998 seconds (358.05 k allocations: 1.065 GiB, 0.01% gc time, 0.03% compilation time)
julia> using GroebnerBasis, Singular, Nemo;
julia> # problem
svs = ["a", "b", "c"]; sys((a, b, c)) = [(a+b)^5+c-3,(b+c)^5+a-2,(2*c+a)^5+b-1];
julia> R, vs = Singular.PolynomialRing(Singular.QQ, svs);
julia> # run msolve
@time prm, nmc = msolve(Ideal(R, sys(vs)), get_param = true);
3.348726 seconds (3.36 M allocations: 204.432 MiB, 1.05% gc time, 96.05% compilation time)
julia> p1, _, p3, p4, p5, p6 = prm;
julia> # vars. order
pmt = map(s->findfirst(e->e==s, p1), svs);
julia> # for factors
fcs = factor(p3); println("#irr_fct_elm: ", length(fcs))
#irr_fct_elm: 1
julia> for (fct, _) in fcs
print("deg: ", Singular.degree(fct), "\nrur time:");
# rur using nf_elem
p = Nemo.NumberField(fct, "p")[2];
@time rur = vcat([Nemo.evaluate((-1)*e1, p)//Nemo.evaluate(e2*p4, p) for (e1, e2) in zip(p5, p6)], [p]);
# Symbolic test
@time println(sys(rur[pmt]));
# Numeric test for raw
map(e->println(sys(map(Float64, e[pmt]))), nmc);
# Numeric test for solve_rational_parametrization
@time srp = solve_rational_parametrization(prm[3:end], precision = 100);
map(e->println(sys(map(Float64, e[pmt]))), srp);
end;
deg: 125
rur time: 1.995804 seconds (1.41 M allocations: 171.327 MiB, 1.16% gc time, 23.01% compilation time)
nf_elem[0, 0, 0]
0.745820 seconds (642.35 k allocations: 196.643 MiB, 1.31% gc time, 55.69% compilation time)
[-2.220446049250313e-15, -8.881784197001252e-16, 0.0]
den: fmpq_poly
2.880423 seconds (3.58 M allocations: 205.021 MiB, 1.46% gc time, 0.58% compilation time)
[-2.220446049250313e-15, -8.881784197001252e-16, 0.0]? msolve2("kat10-qq");
--2021-04-20 22:46:37-- https://gitlab.lip6.fr/eder/msolve-examples/-/raw/master/zero-dimensional/kat10-qq.ms
Resolving gitlab.lip6.fr (gitlab.lip6.fr)... 132.227.201.130
Connecting to gitlab.lip6.fr (gitlab.lip6.fr)|132.227.201.130|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 665 [text/plain]
Saving to: 'kat10-qq.ms'
kat10-qq.ms 100%[===========================================>] 665 --.-KB/s in 0s
2021-04-20 22:46:39 (36.0 MB/s) - 'kat10-qq.ms' saved [665/665]
26.73user 0.01system 0:26.77elapsed 99%CPU (0avgtext+0avgdata 21152maxresident)k
0inputs+8144outputs (0major+15298minor)pagefaults 0swaps
120[[0,0,0,0,0,0,0,0,0,0]]
time = 271 ms.Tst.jl
using GroebnerBasis, Singular, Nemo;
# for global R, I
function tst1()
vs = gens(R);
sys(lst) = (
map(e->eval(Meta.parse("$(e[1]) = $(e[2])")), zip(vs, lst));
map(e->eval(Meta.parse("$e")), gens(I))
);
# run msolve
print("msolve with param: ");
@time prm, nmc = msolve(I, get_param = true);
# vars. order
p1 = prm[1]; println(p1);
pmt = map(s->findfirst(e->e==string(s), p1), vs);
# tests
tst0(sys, prm, nmc, pmt);
end;
# for global svs, sys
function tst2()
R, vs = Singular.PolynomialRing(Singular.QQ, svs);
# run msolve
print("msolve with param: ");
@time prm, nmc = msolve(Ideal(R, sys(vs)), get_param = true);
# vars. order
p1 = prm[1]; println(p1);
pmt = map(s->findfirst(e->e==s, p1), svs);
# tests
tst0(sys, prm, nmc, pmt);
end;
# rur and tests
function tst0(sys, prm, nmc, pmt)
p3, p4, p5, p6 = prm[3:end];
# for factors
fcs = factor(p3); println("#irr_fct_elm: ", length(fcs));
for (fct, _) in fcs
print("deg: ", degree(fct), "\nrur:");
# rur
global p = Nemo.NumberField(fct, "p")[2];
@time global rur = vcat(
[Nemo.evaluate((-1)*p5[k], p)//Nemo.evaluate(e*p4, p) for (k, e) in enumerate(p6)],
[p]
);
# Symbolic test
println("sym:");
@time println(sys(rur[pmt]));
# Numeric test for raw
println("num_raw:");
map(e->println(sys(map(Float64, e[pmt]))), nmc);
# Numeric test for solve_rational_parametrization
println("num_srp:");
@time srp = solve_rational_parametrization(prm[3:end], precision = 100);
map(e->println(sys(map(Float64, e[pmt]))), srp);
end;
end;
#=
# prob.1
R, I = GroebnerBasis.katsura_4(0);
tst1();
# prob.2
svs = ["a", "b", "c"];
sys((a, b, c)) = [-1+c+b+a^3, -1+b+c*a+2*a^3, 1+c*b+c^2*a];
tst2();
# prob.3
R, (a, b, c) = Singular.PolynomialRing(Singular.QQ, ["a", "b", "c"]);
I = Ideal(R, [a^16+b+c, a+b^3+c-2, a*b*c-1]);
for n = 1:50 tst1() end;
# prob.4
svs = ["a", "b", "c"];
for n in [16, 25, 27, 29, 31, 38, 40, 42, 44, 46, 51, 55, 61, 66, 68, 70, 74, 76, 91];
println(n," >>>");
global sys((a, b, c)) = [a^n+b+c, a+b^3+c-2, a*b*c-1];
tst2();
end;
=#https://arxiv.org/pdf/2104.03572.pdf
https://msolve.lip6.fr/
https://icerm.brown.edu/video_archive/?play=2455