Engine prototype #13

Merged
glen merged 133 commits from engine-proto into main 2024-10-21 03:18:48 +00:00
5 changed files with 33 additions and 31 deletions
Showing only changes of commit 2038103d80 - Show all commits

View File

@ -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()

View File

@ -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

View File

@ -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]
#=

View File

@ -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
#=

View File

@ -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]