Skip to content

Commit

Permalink
Tests do not pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Sasha Demin committed May 17, 2023
1 parent bac5b0a commit 87bb05e
Show file tree
Hide file tree
Showing 14 changed files with 744 additions and 55 deletions.
51 changes: 51 additions & 0 deletions experimental/runge-kutta/RK-6-6.mpl

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions experimental/runge-kutta/aa-runge-kutta-4-4.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
R, (a_21, a_31, a_32, a_41, a_42, a_43, b_1, b_2, b_3, b_4) = PolynomialRing(QQ, ["a_21", "a_31", "a_32", "a_41", "a_42", "a_43", "b_1", "b_2", "b_3", "b_4"])

system = [
b_1 + b_2 + b_3 + b_4 - 1,
2*a_21*b_2 + 2*a_31*b_3 + 2*a_32*b_3 + 2*a_41*b_4 + 2*a_42*b_4 + 2*a_43*b_4 - 1,
6*a_21*a_32*b_3 + 6*a_21*a_42*b_4 + 6*a_31*a_43*b_4 + 6*a_32*a_43*b_4 - 1,
3*a_21^2*b_2 + 3*a_31^2*b_3 + 6*a_31*a_32*b_3 + 3*a_32^2*b_3 + 3*a_41^2*b_4 + 6*a_41*a_42*b_4 + 6*a_41*a_43*b_4 + 3*a_42^2*b_4 + 6*a_42*a_43*b_4 + 3*a_43^2*b_4 - 1,
24*a_21*a_32*a_43*b_4 - 1,
12*a_21^2*a_32*b_3 + 12*a_21^2*a_42*b_4 + 12*a_31^2*a_43*b_4 + 24*a_31*a_32*a_43*b_4 + 12*a_32^2*a_43*b_4 - 1,
8*a_21*a_31*a_32*b_3 + 8*a_21*a_32^2*b_3 + 8*a_21*a_41*a_42*b_4 + 8*a_21*a_42^2*b_4 + 8*a_21*a_42*a_43*b_4 + 8*a_31*a_41*a_43*b_4 + 8*a_31*a_42*a_43*b_4 + 8*a_31*a_43^2*b_4 + 8*a_32*a_41*a_43*b_4 + 8*a_32*a_42*a_43*b_4 + 8*a_32*a_43^2*b_4 - 1,
4*a_21^3*b_2 + 4*a_31^3*b_3 + 12*a_31^2*a_32*b_3 + 12*a_31*a_32^2*b_3 + 4*a_32^3*b_3 + 4*a_41^3*b_4 + 12*a_41^2*a_42*b_4 + 12*a_41^2*a_43*b_4 + 12*a_41*a_42^2*b_4 + 24*a_41*a_42*a_43*b_4 + 12*a_41*a_43^2*b_4 + 4*a_42^3*b_4 + 12*a_42^2*a_43*b_4 + 12*a_42*a_43^2*b_4 + 4*a_43^3*b_4 - 1,
]
41 changes: 41 additions & 0 deletions experimental/runge-kutta/aa-runge-kutta-6-6.jl

Large diffs are not rendered by default.

89 changes: 89 additions & 0 deletions experimental/runge-kutta/aa-runge-kutta-8-7.jl

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions experimental/runge-kutta/orderings.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

using AbstractAlgebra
import Combinatorics
using Plots
using Random
include("yang.jl")

R = parent(polys[1])

xs = gens(R)
times = Dict()
Groebner._perm[] = collect(1:length(xs))

@profview Groebner.groebner(
polys,
ordering=Groebner.DegRevLex(),
linalg=:prob
);

times[Groebner._perm[]] = t.time

i = 0
for ord in Combinatorics.permutations(collect(1:length(xs)))
Groebner._perm[] = shuffle(collect(1:length(xs)))

t = @timed Groebner.groebner(
polys,
ordering=Groebner.DegRevLex(),
linalg=:prob
);
times[Groebner._perm[]] = t.time
if i == 1
break
end
i += 1
end
46 changes: 41 additions & 5 deletions experimental/runge-kutta/run.jl
Original file line number Diff line number Diff line change
@@ -1,20 +1,56 @@
using DynamicPolynomials
using Groebner
import Profile
import Nemo

macro pr(ex, args...)
return quote
Profile.clear()
Profile.init(n=10^7, delay=1e-5)
Profile.init(n=10^8, delay=1e-5)
Profile.@profile $(esc(ex))
view_profile(; $(esc.(args)...))
end
end

include((@__DIR__)*"/runge-kutta-6-6.jl");
using Nemo
include((@__DIR__)*"/aa-runge-kutta-8-7.jl");

vs = split("a_21 a_31 a_32 a_41 a_42 a_43 a_51 a_52 a_53 a_54 a_61 a_62 a_63 a_64 a_65 b_1 b_2 b_3 b_4 b_5 b_6")
length(vs)
@time gb = Groebner.groebner(
system,
ordering=Groebner.DegRevLex(),
maxpairs=1000
);

vs = split("a_21 a_31 a_32 a_41 a_42 a_43 a_51 a_52 a_53 a_54 a_61 a_62 a_63 a_64 a_65 a_71 a_72 a_73 a_74 a_75 a_76 a_81 a_82 a_83 a_84 a_85 a_86 a_87 b_1 b_2 b_3 b_4 b_5 b_6 b_7 b_8")
vs
ord = Groebner.WeightedOrdering([[10 for i in 1:28]..., [1 for i in 1:8]...])

gb = Groebner.groebner(
system,
linalg=:prob,
# ordering=ord
);

println(gb)

using AbstractAlgebra
include((@__DIR__)*"/aa-runge-kutta-6-6.jl");
length(system)
gens(parent(system[1]))

system_autoreduced = deepcopy(system);
for i in 1:length(system)
f = system_autoreduced[i]
I = system[i .!= 1:length(system)]
system_autoreduced[i] = AbstractAlgebra.normal_form(f, I)
end;

@pr gb = Groebner.groebner(
system,
linalg=:prob,
ordering=DegRevLex()
);

@time Groebner.groebner(system,linalg=:prob);
@polyvar x y z a b c
s = [y, x, z, a + b^2 + c^3]
g = groebner(s, ordering=Groebner.WeightedOrdering([1,10,10,1,1,1]))
72 changes: 72 additions & 0 deletions experimental/runge-kutta/yang.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
using AbstractAlgebra
R1, (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V) = PolynomialRing(GF(101), ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V"], ordering = :degrevlex);
polys = [
d*g*j*m-c*h*j*m-d*f*k*m+b*h*k*m+c*f*l*m-b*g*l*m-d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