From a569302ca2253d15943ff4114556ca9f9fd317d0 Mon Sep 17 00:00:00 2001 From: ysyapa Date: Tue, 23 Jan 2024 18:54:44 +0000 Subject: [PATCH] Exact values for comparison --- EC_test.ipynb | 7 ++++++- p_space.jl | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/EC_test.ipynb b/EC_test.ipynb index 2daa773..061d003 100644 --- a/EC_test.ipynb +++ b/EC_test.ipynb @@ -57,10 +57,14 @@ "outputs": [], "source": [ "extrapolate_points = range(0.40, 0.20, 5)\n", - "extrapolate_E = Vector{ComplexF64}(undef, length(extrapolate_points))\n", "ref_E = 0.2 - 0.1im\n", "\n", + "exact_E = Vector{ComplexF64}(undef, length(extrapolate_points))\n", + "extrapolate_E = Vector{ComplexF64}(undef, length(extrapolate_points))\n", + "\n", "for (j, c) in enumerate(extrapolate_points)\n", + " exact_E[j] = quick_pole_E(V_system(c))\n", + "\n", " EC_basis_w = EC_basis .* w\n", " H = get_H_matrix(V_system(c), p, w)\n", " H_EC = transpose(EC_basis) * H * EC_basis\n", @@ -72,6 +76,7 @@ "end\n", "\n", "scatter(real.(training_E), imag.(training_E), label=\"training\")\n", + "scatter!(real.(exact_E), imag.(exact_E), label=\"exact\")\n", "scatter!(real.(extrapolate_E), imag.(extrapolate_E), label=\"extrapolated\")\n", "plot!(real.(mesh_E), imag.(mesh_E), label=\"contour\")\n", "xlims!(0,1)" diff --git a/p_space.jl b/p_space.jl index 2883769..3915930 100644 --- a/p_space.jl +++ b/p_space.jl @@ -39,4 +39,10 @@ function identify_pole_i(p, evals, μ=0.5) end end return current_i +end + +function quick_pole_E(V_pq, μ=0.5; cs_angle=0.5, cutoff=8.0, meshpoints=256) + p, w = get_mesh([0, cutoff * exp(-1im * cs_angle)], meshpoints) + evals = eigvals(get_H_matrix(V_pq, p, w)) + return evals[identify_pole_i(p, evals)] end \ No newline at end of file