-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to measure the coincidence expectation value #46
Comments
Hi again and sorry for the delay! How exactly did you define wd1,w1, w2, and wd2? If you are using the 2 waveguide basis:
I am here defining a twophoton state that either resides as a |02>+|20> photon state or in a |11> photon state. As expected, your operator only gives 1 for the later state, as the first state has no simultaneous photons in both waveguides. From our interactions, I learned that using expect() to define the expectation value of the whole waveguide is not consistent when the user has defined many different operators. I am, therefore, working on an update to introduce the function expect_waveguide(), which I defined for you in the above. From now on, this operator should be used when wanting expectation values of waveguide states / operators. I also noticed some inconsistencies when trying to combine operators the way you did through (WaveguideInteraction times WaveguideOperator), which I am also working on fixing. For now, the above should solve the problem for you. best Matias |
A correction to the above is that probably what you are interested in when you write:
|
This is very useful. Thank you very much! I realized that the sum in I do have a further question about constructing an arbitrary state. Is it possible to construct a waveguide state as the following: We have 2 waveguides defined by their ladder operators I tried to use bw = WaveguideBasis(2, 2, times)
ξ(t, t0=5, σ=1) = complex(√(2/σ)*(log(2)/pi)^(1/4)*exp(-2*log(2)*(t-t0)^2/σ^2))
ξ1(t1, t2, t01, t02) = ξ(t1, t01) * ξ(t2, t02)
ξ2(t1, t2, t01, t02) = ξ(t2, t01) * ξ(t1, t02)
t01 = 5
t02 = 5 + τ
ψ = twophoton(bw, 1, ξ1, t01, t02)/2 - twophoton(bw, 2, ξ1, t01, t02)/2 + twophoton(bw, [1, 2], ξ2, t01, t02)/2 - twophoton(bw, [1, 2], ξ1, t01, t02)/2
expval1 = expect(wd1*w1, ψ) # This is 1 for large τ, but drops to 0.5 for τ = 0, which is confusing. Would you have any immediate suggestions? Thank you very much! |
I see... The problem is indeed with normalization in the above example. I'm not sure I immediately understand what goes wrong, but a quick fix is the following: ψ = twophoton(bw, 1, ξ1, t01, t02)/2 - twophoton(bw, 2, ξ1, t01, t02)/2 + twophoton(bw, [1, 2], ξ2, t01, t02)/2 - twophoton(bw, [1, 2], ξ1, t01, t02)/2
ψ = normalize(ψ) I will have to look into how multiple twophoton creation objects are combined correctly, to give it a more permanent fix. |
Hi, I am wondering if there is any update on this. I am thinking about doing projective measurements on such 2-waveguide superposition state, for example, evaluating expectation value for the operator: Would you have a chance to provide an example of a beamsplitter simulation? I guess that would be super useful for other users as well. Thank you very much! |
Okay, so there are many details of this that need to be addressed, and I'm not entirely sure how to deal with all of them. First of all, can you provide more details on the operator P? I guess there should be some time dependence on EDIT: Disregard the following, I didn't account for the integral in the below which solves the problem. I will get back with an update once I have time. Secondarily, the normalization problem is not trivial to solve since the code assumes the wavefunction (of two photons in the same waveguide) to be symmetric under exchange of two times: The wavefunction for the two-photon state in, e.g., waveguide 1 does now only obey the symmetry relation if Thank you for your patience. |
Yes, sorry for the delay. The projective measurement operator should be where Interestingly, I recently evaluated the expectation value Thank you very much! |
Okay, perfect, thank you! Please see the example I provided in the documentation under the tab Beamsplitter, hopefully this is what you requested. I fixed a few bugs in this update, so be sure to update waveguideQED. The biggest was how I initialized the two-photon waveguide state. Something is still funny about normalization, but for now, your fix with normalizing also works. See this:
This works now, but as I show in the documentation, one could avoid this problem totally by performing the beamsplitter operation by letting the waveguide state evolve under the Hamiltonian: |
Hi, Thank you for the helpful example! The simulation with Hamiltonian fixes our problem. But we do want to mention a potential problem here. As demonstrated in the following code, when using the constructed state, the unnormalized state has the same coincidence as the evolved state (but the wrong expectation value of the photon number in a single waveguide), while the normalized state fixes the expectation value but breaks the coincidence. The plot is attached for reference. Maybe there's a problem caused by the state construction? Thank you for your effort! using QuantumOptics
using WaveguideQED
using LinearAlgebra
using LaTeXStrings
using Plots
times = 0:0.1:10
dt = times[2] - times[1]
bw = WaveguideBasis(2, 2, times)
wd1 = create(bw, 1)
w1 = destroy(bw, 1)
wd2 = create(bw, 2)
w2 = destroy(bw, 2)
n1 = wd1*w1
n2 = wd2*w2
ξ(t, t0=5, σ=1) = complex(√(2/σ)*(log(2)/pi)^(1/4)*exp(-2*log(2)*(t-t0)^2/σ^2))
ξ1(t1, t2, t01, t02) = ξ(t1, t01) * ξ(t2, t02)
ξ2(t1, t2, t01, t02) = ξ(t2, t01) * ξ(t1, t02)
function expect_coincidence(n1, n2, psi, times)
psi_c = copy(psi)
expval = 0
for i in eachindex(times)
set_waveguidetimeindex!(n1, i)
for j in eachindex(times)
set_waveguidetimeindex!(n2, j)
mul!(psi_c, n1*n2, psi)
expval += dot(psi_c.data, psi.data)
end
end
return expval
end
H = π/4/dt*(wd1*w2 + wd2*w1)
values = [[], [], []]
τs = -3:0.1:3
for τ ∈ τs
t01 = 5
t02 = 5 + τ
ψ1 = waveguide_evolution(times, twophoton(bw, [1, 2], ξ1, t01, t02), H)
expval1 = expect_coincidence(n1, n2, ψ1, times) # by evolution, agree with analytical result
ψ2 = twophoton(bw, 1, ξ1, t01, t02, norm=true)/2 - twophoton(bw, 2, ξ1, t01, t02, norm=true)/2 + twophoton(bw, [2, 1], ξ1, t01, t02, norm=true)/2 - twophoton(bw, [1, 2], ξ1, t01, t02, norm=true)/2
expval2 = expect_coincidence(n1, n2, ψ2, times) # by construction, unnormalized, agree with analytical result
ψ3 = twophoton(bw, 1, ξ1, t01, t02, norm=true)/2 - twophoton(bw, 2, ξ1, t01, t02, norm=true)/2 + twophoton(bw, [2, 1], ξ1, t01, t02, norm=true)/2 - twophoton(bw, [1, 2], ξ1, t01, t02, norm=true)/2
ψ3 = normalize(ψ3)
expval3 = expect_coincidence(n1, n2, ψ3, times) # by construction, normalized, DISAGREE with analytical result
append!(values[1], expval1)
append!(values[2], expval2)
append!(values[3], expval3)
end
plot(τs, values[1], label="Evolution", lw=3, ylim=[0, 1.02], title=latexstring("Coincidence (\$\\eta = 1/2\$)"), xlabel="Pulse Delay Time (τ)", ylabel="Expectation Value")
plot!(τs, values[2], label="Unnormalized")
plot!(τs, values[3], label="Normalized")
savefig("../plots/coincidence.pdf") |
There was indeed a problem with state construction. Forcing normalization on construction (norm=true by default) was causing the combined state ψ2 and ψ3 to not be normalized. Now, two-photon states are initialized without a prefactor of 1/sqrt(2) and are not, per default, normalized. This makes the above example work (see the updated documentation: https://qojulia.github.io/WaveguideQED.jl/dev/beamsplitter/) because now ψ2 and ψ3 do not need to be normalized as they are normalized from construction (remember to not enforce normalization on each individual term, that is: norm=false). I hope this helps! |
Thank you very much for your work! With [email protected], all issues regarding this are fixed! |
When doing simulations involving HOM dip, I am wondering if we can compute the expectation value for coincidence:
Where
ψ
is a state with only 2 waveguides, basis defined byWaveguideBasis(2, 2, times)
with proper ladder operators.Currently, Julia throws the error for this expression:
Is there a way to properly compute the expectation value?
Thank you very much!
The text was updated successfully, but these errors were encountered: