Make tetrahedron faces planar

This commit is contained in:
Aaron Fenyes 2024-07-15 23:54:59 -07:00
parent 7c77481f5e
commit e6cf08a9b3

View File

@ -8,16 +8,32 @@ using Random
J = Int64[] J = Int64[]
K = Int64[] K = Int64[]
values = BigFloat[] values = BigFloat[]
for j in 1:5 for j in 1:6
for k in 1:5 for k in 1:6
push!(J, j) filled = false
push!(K, k) if j == 6
if j == k if k <= 4
push!(values, 0)
filled = true
end
elseif k == 6
if j <= 4
push!(values, 0)
filled = true
end
elseif j == k
push!(values, 1) push!(values, 1)
filled = true
elseif (j <= 4 && k <= 4) elseif (j <= 4 && k <= 4)
push!(values, -1/BigFloat(3)) push!(values, -1/BigFloat(3))
filled = true
else else
push!(values, -1) push!(values, -1)
filled = true
end
if filled
push!(J, j)
push!(K, k)
end end
end end
end end
@ -25,19 +41,23 @@ gram = sparse(J, K, values)
# set initial guess # set initial guess
Random.seed!(99230) Random.seed!(99230)
guess = sqrt(1/BigFloat(3)) * BigFloat[ guess = hcat(
sqrt(1/BigFloat(3)) * BigFloat[
1 1 -1 -1 0 1 1 -1 -1 0
1 -1 1 -1 0 1 -1 1 -1 0
1 -1 -1 1 0 1 -1 -1 1 0
1 1 1 1 -2 1 1 1 1 -2
1 1 1 1 1 1 1 1 1 1
] + 0.2*Engine.rand_on_shell(fill(BigFloat(-1), 5)) ] + 0.2*Engine.rand_on_shell(fill(BigFloat(-1), 5)),
BigFloat[0, 0, 0, 1, 1]
)
frozen = [CartesianIndex(j, 6) for j in 1:5]
# complete the gram matrix # complete the gram matrix
#= #=
L, history = Engine.realize_gram_newton(gram, guess) L, history = Engine.realize_gram_newton(gram, guess)
=# =#
L, success, history = Engine.realize_gram(gram, guess) L, success, history = Engine.realize_gram(gram, guess, frozen)
completed_gram = L'*Engine.Q*L completed_gram = L'*Engine.Q*L
println("Completed Gram matrix:\n") println("Completed Gram matrix:\n")
display(completed_gram) display(completed_gram)