Find real solutions for three mutually tangent spheres

I'm not sure why the solver wasn't working before. It might've been just
an unlucky random number draw.
This commit is contained in:
Aaron Fenyes 2024-02-15 16:16:06 -08:00
parent ae5db0f9ea
commit ba365174d3
2 changed files with 19 additions and 19 deletions

View File

@ -186,16 +186,16 @@ 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
##if !isempty(ctx.spheres)
## append!(eqns, [sum(sph.coords[k] for sph in ctx.spheres) for k in 3:4])
##end
##n_elts = length(ctx.points) + length(ctx.spheres)
##if n_elts > 0
## push!(eqns, sum(elt.vec[2] for elt in Iterators.flatten((ctx.points, ctx.spheres))) - n_elts)
##end
if !isempty(ctx.points)
append!(eqns, [sum(pt.coords[k] for pt in ctx.points) for k in 1:3])
end
if !isempty(ctx.spheres)
append!(eqns, [sum(sph.coords[k] for sph in ctx.spheres) for k in 3:4])
end
n_elts = length(ctx.points) + length(ctx.spheres)
if n_elts > 0
push!(eqns, sum(elt.vec[2] for elt in Iterators.flatten((ctx.points, ctx.spheres))) - n_elts)
end
(Generic.Ideal(coordring, eqns), eqns)
## [test] (nothing, eqns)

View File

@ -59,13 +59,13 @@ tangencies = [
ctx_tan_sph = Engine.Construction{CoeffType}(elements = spheres, relations = tangencies)
ideal_tan_sph, eqns_tan_sph = Engine.realize(ctx_tan_sph)
##small_eqns_tan_sph = eqns_tan_sph
small_eqns_tan_sph = [
eqns_tan_sph;
spheres[2].coords - [1, 0, 0, 0, 1];
spheres[3].coords - [1, 0, 0, 0, -1];
]
small_ideal_tan_sph = Generic.Ideal(base_ring(ideal_tan_sph), small_eqns_tan_sph)
freedom = Engine.dimension(small_ideal_tan_sph)
##small_eqns_tan_sph = [
## eqns_tan_sph;
## spheres[2].coords - [1, 0, 0, 0, 1];
## spheres[3].coords - [1, 0, 0, 0, -1];
##]
##small_ideal_tan_sph = Generic.Ideal(base_ring(ideal_tan_sph), small_eqns_tan_sph)
freedom = Engine.dimension(ideal_tan_sph)
println("Three mutually tangent spheres, with two fixed: $freedom degrees of freedom")
##points = [Engine.Point{CoeffType}() for _ in 1:3]
@ -83,11 +83,11 @@ println("Three mutually tangent spheres, with two fixed: $freedom degrees of fre
# --- test rational cut ---
coordring = base_ring(small_ideal_tan_sph)
coordring = base_ring(ideal_tan_sph)
vbls = Variable.(symbols(coordring))
# test a random witness set
system = CompiledSystem(System(small_eqns_tan_sph, variables = vbls))
system = CompiledSystem(System(eqns_tan_sph, variables = vbls))
norm2 = vec -> real(dot(conj.(vec), vec))
rng = MersenneTwister(6071)
n_planes = 3