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:
parent
ae5db0f9ea
commit
ba365174d3
@ -186,16 +186,16 @@ function realize(ctx::Construction{T}) where T
|
|||||||
# add relations to center, orient, and scale the construction
|
# add relations to center, orient, and scale the construction
|
||||||
# [to do] the scaling constraint, as written, can be impossible to satisfy
|
# [to do] the scaling constraint, as written, can be impossible to satisfy
|
||||||
# when all of the spheres have to go through the origin
|
# when all of the spheres have to go through the origin
|
||||||
##if !isempty(ctx.points)
|
if !isempty(ctx.points)
|
||||||
## append!(eqns, [sum(pt.coords[k] for pt in ctx.points) for k in 1:3])
|
append!(eqns, [sum(pt.coords[k] for pt in ctx.points) for k in 1:3])
|
||||||
##end
|
end
|
||||||
##if !isempty(ctx.spheres)
|
if !isempty(ctx.spheres)
|
||||||
## append!(eqns, [sum(sph.coords[k] for sph in ctx.spheres) for k in 3:4])
|
append!(eqns, [sum(sph.coords[k] for sph in ctx.spheres) for k in 3:4])
|
||||||
##end
|
end
|
||||||
##n_elts = length(ctx.points) + length(ctx.spheres)
|
n_elts = length(ctx.points) + length(ctx.spheres)
|
||||||
##if n_elts > 0
|
if n_elts > 0
|
||||||
## push!(eqns, sum(elt.vec[2] for elt in Iterators.flatten((ctx.points, ctx.spheres))) - n_elts)
|
push!(eqns, sum(elt.vec[2] for elt in Iterators.flatten((ctx.points, ctx.spheres))) - n_elts)
|
||||||
##end
|
end
|
||||||
|
|
||||||
(Generic.Ideal(coordring, eqns), eqns)
|
(Generic.Ideal(coordring, eqns), eqns)
|
||||||
## [test] (nothing, eqns)
|
## [test] (nothing, eqns)
|
||||||
|
@ -59,13 +59,13 @@ tangencies = [
|
|||||||
ctx_tan_sph = Engine.Construction{CoeffType}(elements = spheres, relations = tangencies)
|
ctx_tan_sph = Engine.Construction{CoeffType}(elements = spheres, relations = tangencies)
|
||||||
ideal_tan_sph, eqns_tan_sph = Engine.realize(ctx_tan_sph)
|
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
|
||||||
small_eqns_tan_sph = [
|
##small_eqns_tan_sph = [
|
||||||
eqns_tan_sph;
|
## eqns_tan_sph;
|
||||||
spheres[2].coords - [1, 0, 0, 0, 1];
|
## spheres[2].coords - [1, 0, 0, 0, 1];
|
||||||
spheres[3].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)
|
##small_ideal_tan_sph = Generic.Ideal(base_ring(ideal_tan_sph), small_eqns_tan_sph)
|
||||||
freedom = Engine.dimension(small_ideal_tan_sph)
|
freedom = Engine.dimension(ideal_tan_sph)
|
||||||
println("Three mutually tangent spheres, with two fixed: $freedom degrees of freedom")
|
println("Three mutually tangent spheres, with two fixed: $freedom degrees of freedom")
|
||||||
|
|
||||||
##points = [Engine.Point{CoeffType}() for _ in 1:3]
|
##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 ---
|
# --- test rational cut ---
|
||||||
|
|
||||||
coordring = base_ring(small_ideal_tan_sph)
|
coordring = base_ring(ideal_tan_sph)
|
||||||
vbls = Variable.(symbols(coordring))
|
vbls = Variable.(symbols(coordring))
|
||||||
|
|
||||||
# test a random witness set
|
# 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))
|
norm2 = vec -> real(dot(conj.(vec), vec))
|
||||||
rng = MersenneTwister(6071)
|
rng = MersenneTwister(6071)
|
||||||
n_planes = 3
|
n_planes = 3
|
||||||
|
Loading…
Reference in New Issue
Block a user