67 lines
2.2 KiB
Julia
67 lines
2.2 KiB
Julia
using Roots, LinearAlgebra, Plots
|
|
|
|
include("../EC.jl")
|
|
include("../common.jl")
|
|
include("../ho_basis.jl")
|
|
|
|
V_of_r(r) = 2 * exp(-(r-3)^2 / (1.5)^2)
|
|
Λ = 0
|
|
m = 1.0
|
|
|
|
ϕ = 0.1
|
|
μω_global = 0.5 * exp(-2im * ϕ)
|
|
E_max = 40
|
|
|
|
H0 = get_3b_H_matrix(jacobi, V_of_r, μω_global, E_max, Λ, m, true, true)
|
|
|
|
# Vp = perturbation to make the state artificially bound
|
|
Vp_of_r(r) = -exp(-(r/3)^2)
|
|
@time "Vp" Vp = get_3b_H_matrix(jacobi, Vp_of_r, μω_global, E_max, Λ, m, false, true)
|
|
|
|
training_ref = -2.22
|
|
extrapolating_ref = [4.076662025307587-0.012709842443350328im,
|
|
3.613318119833891-0.007335804709990623im,
|
|
3.1453431847006783-0.004030580410326795im,
|
|
2.672967129943755-0.00211498327461944im,
|
|
2.196542557810288-0.0010719835443437104im,
|
|
1.7164583929199813-0.0005455212208182736im,
|
|
1.233088227541505-0.0003070320106485624im]
|
|
|
|
training_c = [2.6, 2.4, 2.2, 2.0, 1.8]
|
|
extrapolating_c = 0.0 : 0.2 : 1.2
|
|
|
|
EC = affine_EC(H0, Vp)
|
|
train!(EC, training_c; ref_eval=training_ref, CAEC=true)
|
|
extrapolate!(EC, extrapolating_c; ref_eval=extrapolating_ref)
|
|
|
|
# determining c0 with EC
|
|
approx_c0 = 1.5
|
|
quick_extrapolate(c) = minimum(abs2, get_extrapolated_evals(EC.H0_EC, EC.H1_EC, EC.N_EC, c, 1e-14))
|
|
c0 = find_zero(quick_extrapolate, approx_c0)
|
|
|
|
order::Int = ceil((length(training_c) - 1) / 2) # order of the Pade approximant
|
|
|
|
# Solve coefficients as a linear system
|
|
training_k = alt_sqrt.(EC.training_E)
|
|
M_left_element(c, i) = alt_sqrt(c - c0)^i
|
|
M_left = M_left_element.(training_c, (0:order)')
|
|
M_right = -training_k .* M_left[:, 2:end] # remove the first column
|
|
M = hcat(M_left, M_right) # M = [M_left | M_right]
|
|
sol = M \ training_k
|
|
a = sol[1:order+1]
|
|
b = [1; sol[order+2:end]]
|
|
|
|
# Pade approximant
|
|
polynomial(a, c) = sum(i -> a[i+1] * alt_sqrt(c - c0)^i, 0:order)
|
|
pade_approx(c) = polynomial(a, c) / polynomial(b, c)
|
|
|
|
# Extrapolate
|
|
extrapolated_k = pade_approx.([extrapolating_c; training_c])
|
|
extrapolated_E = extrapolated_k .^ 2
|
|
|
|
# Plotting
|
|
scatter(real.(EC.training_E), imag.(EC.training_E), label="training")
|
|
scatter!(real.(EC.exact_E), imag.(EC.exact_E), label="exact")
|
|
scatter!(real.(EC.extrapolated_E), imag.(EC.extrapolated_E), label="CAEC", m=:x)
|
|
scatter!(real.(extrapolated_E), imag.(extrapolated_E), label="ACCC", m=:+)
|