From 31d5e7e864704895dbf0273c46185476e53e40f1 Mon Sep 17 00:00:00 2001 From: Aaron Fenyes Date: Mon, 12 Feb 2024 22:48:16 -0500 Subject: [PATCH] Play with two points on two spheres Guess conditions that make the scaling constraint impossible to satisfy. --- engine-proto/Engine.Algebraic.jl | 2 ++ engine-proto/Engine.jl | 43 +++++++++++++++++++++++--------- 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/engine-proto/Engine.Algebraic.jl b/engine-proto/Engine.Algebraic.jl index b9b790a..ca39967 100644 --- a/engine-proto/Engine.Algebraic.jl +++ b/engine-proto/Engine.Algebraic.jl @@ -184,6 +184,8 @@ function realize(ctx::Construction{T}) where T ) # add relations to center, orient, and scale the construction + # [to do] the scaling constraint, as written, can be impossible to satisfy + # when all of the spheres have to go through the origin if !isempty(ctx.points) append!(eqns, [sum(pt.coords[k] for pt in ctx.points) for k in 1:3]) end diff --git a/engine-proto/Engine.jl b/engine-proto/Engine.jl index 113c6a3..7ddf72d 100644 --- a/engine-proto/Engine.jl +++ b/engine-proto/Engine.jl @@ -39,7 +39,7 @@ CoeffType = Rational{Int64} ##freedom = Engine.dimension(ideal_ab_s) ##println("Two points on a sphere: $freedom degrees of freedom") -spheres = [Engine.Sphere{CoeffType}() for _ in 1:3] +##spheres = [Engine.Sphere{CoeffType}() for _ in 1:3] ##tangencies = [ ## Engine.AlignsWithBy{CoeffType}( ## spheres[n], @@ -48,26 +48,45 @@ spheres = [Engine.Sphere{CoeffType}() for _ in 1:3] ## ) ## for n in 1:3 ##] -tangencies = [ - Engine.AlignsWithBy{CoeffType}(spheres[1], spheres[2], CoeffType(-1)), - Engine.AlignsWithBy{CoeffType}(spheres[2], spheres[3], CoeffType(-1//2)) -] -ctx_tan_sph = Engine.Construction{CoeffType}(elements = Set(spheres), relations = Set(tangencies)) -ideal_tan_sph, eqns_tan_sph = Engine.realize(ctx_tan_sph) -freedom = Engine.dimension(ideal_tan_sph) +##tangencies = [ + ##Engine.LiesOn{CoeffType}(points[1], spheres[2]), + ##Engine.LiesOn{CoeffType}(points[1], spheres[3]), + ##Engine.LiesOn{CoeffType}(points[2], spheres[3]), + ##Engine.LiesOn{CoeffType}(points[2], spheres[1]), + ##Engine.LiesOn{CoeffType}(points[3], spheres[1]), + ##Engine.LiesOn{CoeffType}(points[3], spheres[2]) +##] +##ctx_tan_sph = Engine.Construction{CoeffType}(elements = Set(spheres), relations = Set(tangencies)) +##ideal_tan_sph, eqns_tan_sph = Engine.realize(ctx_tan_sph) +##freedom = Engine.dimension(ideal_tan_sph) ##println("Three mutually tangent spheres: $freedom degrees of freedom") -println("Chain of three spheres: $freedom degrees of freedom") + +p = Engine.Point{CoeffType}() +q = Engine.Point{CoeffType}() +a = Engine.Sphere{CoeffType}() +b = Engine.Sphere{CoeffType}() +p_on_a = Engine.LiesOn{CoeffType}(p, a) +p_on_b = Engine.LiesOn{CoeffType}(p, b) +q_on_a = Engine.LiesOn{CoeffType}(q, a) +q_on_b = Engine.LiesOn{CoeffType}(q, b) +ctx_joined = Engine.Construction{CoeffType}( + elements = Set([p, q, a, b]), + relations= Set([p_on_a, p_on_b, q_on_a, q_on_b]) +) +ideal_joined, eqns_joined = Engine.realize(ctx_joined) +freedom = Engine.dimension(ideal_joined) +println("Two points on two spheres: $freedom degrees of freedom") # --- test rational cut --- -coordring = base_ring(ideal_tan_sph) +coordring = base_ring(ideal_joined) vbls = Variable.(symbols(coordring)) # test a random witness set -system = CompiledSystem(System(eqns_tan_sph, variables = vbls)) +system = CompiledSystem(System(eqns_joined, variables = vbls)) norm2 = vec -> real(dot(conj.(vec), vec)) Random.seed!(6071) -n_planes = 16 +n_planes = 3 samples = [] for _ in 1:n_planes real_solns = solution.(Engine.Numerical.real_samples(system, freedom))