From 2038103d805dce9e39f61bac3b2e3cfbf1b11c2c Mon Sep 17 00:00:00 2001 From: Aaron Fenyes Date: Wed, 17 Jul 2024 15:37:14 -0700 Subject: [PATCH] Write examples directly in light cone basis --- engine-proto/ConstructionViewer.jl | 18 ++++++++------- engine-proto/gram-test/Engine.jl | 11 ++++----- engine-proto/gram-test/circles-in-triangle.jl | 4 ++-- .../gram-test/overlapping-pyramids.jl | 23 +++++++++++-------- .../gram-test/sphere-in-tetrahedron.jl | 8 +++---- 5 files changed, 33 insertions(+), 31 deletions(-) diff --git a/engine-proto/ConstructionViewer.jl b/engine-proto/ConstructionViewer.jl index c4845fa..8cfa632 100644 --- a/engine-proto/ConstructionViewer.jl +++ b/engine-proto/ConstructionViewer.jl @@ -207,14 +207,16 @@ end # ~~~ sandbox setup ~~~ -# in the default view, e4 + e5 is the point at infinity -elements = Engine.nullmix * sqrt(0.5) * BigFloat[ - 1 1 -1 -1 0; - 1 -1 1 -1 0; - 1 -1 -1 1 0; - 0 0 0 0 -sqrt(6); - 1 1 1 1 2 -] +elements = begin + const a = sqrt(BigFloat(3)/2) + sqrt(0.5) * BigFloat[ + 1 1 -1 -1 0 + 1 -1 1 -1 0 + 1 -1 -1 1 0 + -0.5 -0.5 -0.5 -0.5 -a-1 + 0.5 0.5 0.5 0.5 -a+1 + ] +end # show construction viewer = Viewer.ConstructionViewer() diff --git a/engine-proto/gram-test/Engine.jl b/engine-proto/gram-test/Engine.jl index 93102f8..920b043 100644 --- a/engine-proto/gram-test/Engine.jl +++ b/engine-proto/gram-test/Engine.jl @@ -29,7 +29,7 @@ function rand_on_shell(rng::AbstractRNG, shell::T) where T <: Number space_part = rand_on_sphere(rng, T, 4) rapidity = randn(rng, T) sig = sign(shell) - [sconh(rapidity, sig)*space_part; sconh(rapidity, -sig)] + nullmix * [sconh(rapidity, sig)*space_part; sconh(rapidity, -sig)] end rand_on_shell(rng::AbstractRNG, shells::Array{T}) where T <: Number = @@ -39,19 +39,16 @@ rand_on_shell(shells::Array{<:Number}) = rand_on_shell(Random.default_rng(), she # === elements === -## [temp] in light cone coordinates point(pos) = [pos; 1; dot(pos, pos)] -## [temp] in standard coordinates -plane(normal, offset) = [normal; offset; offset] +plane(normal, offset) = [normal; 0; offset] -## [temp] in standard coordinates function sphere(center, radius) dist_sq = dot(center, center) [ center / radius; - 0.5 * ((dist_sq - 1) / radius - radius); - 0.5 * ((dist_sq + 1) / radius - radius) + -0.5 / radius; + 0.5 * (dist_sq / radius - radius) ] end diff --git a/engine-proto/gram-test/circles-in-triangle.jl b/engine-proto/gram-test/circles-in-triangle.jl index ec6e1e0..fc5e13d 100644 --- a/engine-proto/gram-test/circles-in-triangle.jl +++ b/engine-proto/gram-test/circles-in-triangle.jl @@ -55,7 +55,7 @@ gram = sparse(J, K, values) ## guess = Engine.rand_on_shell(fill(BigFloat(-1), 8)) # set initial guess -guess = Engine.nullmix * hcat( +guess = hcat( Engine.plane(BigFloat[0, 0, 1], BigFloat(0)), Engine.sphere(BigFloat[0, 0, 0], BigFloat(1//2)), Engine.plane(BigFloat[1, 0, 0], BigFloat(1)), @@ -64,7 +64,7 @@ guess = Engine.nullmix * hcat( Engine.sphere(BigFloat[-1, 0, 0], BigFloat(1//5)), Engine.sphere(BigFloat[cos(-pi/3), sin(-pi/3), 0], BigFloat(1//5)), Engine.sphere(BigFloat[cos(pi/3), sin(pi/3), 0], BigFloat(1//5)), - BigFloat[0, 0, 0, 1, 1] + BigFloat[0, 0, 0, 0, 1] ) frozen = [CartesianIndex(j, 9) for j in 4:5] #= diff --git a/engine-proto/gram-test/overlapping-pyramids.jl b/engine-proto/gram-test/overlapping-pyramids.jl index 706a334..8edb981 100644 --- a/engine-proto/gram-test/overlapping-pyramids.jl +++ b/engine-proto/gram-test/overlapping-pyramids.jl @@ -36,16 +36,19 @@ gram[1, 6] = gram[6, 1] # in this initial guess, the mutual tangency condition is satisfied for spheres # 1 through 5 Random.seed!(50793) -guess = Engine.nullmix * hcat( - sqrt(1/BigFloat(2)) * BigFloat[ - 1 1 -1 -1 0; - 1 -1 1 -1 0; - 1 -1 -1 1 0; - 0 0 0 0 -sqrt(BigFloat(6)); - 1 1 1 1 2; - ] + 0.2*Engine.rand_on_shell(fill(BigFloat(-1), 5)), - Engine.rand_on_shell(fill(BigFloat(-1), 2)) -) +guess = begin + const a = sqrt(BigFloat(3)/2) + hcat( + sqrt(1/BigFloat(2)) * BigFloat[ + 1 1 -1 -1 0 + 1 -1 1 -1 0 + 1 -1 -1 1 0 + -0.5 -0.5 -0.5 -0.5 -a-1 + 0.5 0.5 0.5 0.5 -a+1 + ] + 0.2*Engine.rand_on_shell(fill(BigFloat(-1), 5)), + Engine.rand_on_shell(fill(BigFloat(-1), 2)) + ) +end # complete the gram matrix #= diff --git a/engine-proto/gram-test/sphere-in-tetrahedron.jl b/engine-proto/gram-test/sphere-in-tetrahedron.jl index 6bfb2c0..1c0dda8 100644 --- a/engine-proto/gram-test/sphere-in-tetrahedron.jl +++ b/engine-proto/gram-test/sphere-in-tetrahedron.jl @@ -41,15 +41,15 @@ gram = sparse(J, K, values) # set initial guess Random.seed!(99230) -guess = Engine.nullmix * hcat( +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 -2 - 1 1 1 1 1 + 0 0 0 0 -1.5 + 1 1 1 1 -0.5 ] + 0.2*Engine.rand_on_shell(fill(BigFloat(-1), 5)), - BigFloat[0, 0, 0, 1, 1] + BigFloat[0, 0, 0, 0, 1] ) frozen = [CartesianIndex(j, 6) for j in 1:5]