Introduction

Quantum electrodynamics (QED) is a subset of quantum field theory1 that describes the interaction between matter and the electromagnetic field. This theory treats light as particles called photons. Arguably, QED is the most relevant theory considering the length, time, and energy scale required to observe the fundamental forces. If the matter appears in the form of atoms and molecules, then the combined matter-light system becomes a quantum optical system2. The dynamics of quantum optical systems, which we call quantum optical dynamics (QOD), is also governed by the basic equations of QED. One of the most critical difficulties in solving the equations of QOD is the curse of dimensionality, which comes from the dimension (the size of a basis) of the Hilbert space corresponding to a quantum optical system. A basis can be characterized by “modes”, which roughly corresponds to the different ways in which particles (both matter and photons) can be excited, independently. The number of possible modes is infinite. Even if the number of modes is restricted, the size of the basis increases exponentially in the number of particles present in QOD. A common simplification is to limit the number of modes and/or the total number of particles of each mode to just a few. This approximation returns reasonable results if most contributing degrees of freedom can be confidently identified from previous experiments. Should that fail, we have no other means but to numerically solve high-dimensional equations to accurately analyze QOD.

Known QOD simulation techniques3,4,5,6,7 fall into two categories: cavity QED8 and wave packet dynamics9. In a typical cavity QED simulation, the photonic modes are restricted to a single standing wave mode in the cavity, and the matter-light interaction modeled by the Jaynes–Cummings Hamiltonian10,11. This suffices to explain several physical phenomena such as vacuum Rabi oscillation. On the other hand, the wave-packet-dynamics approach treats photons as a localized wave packet. Previous works treat Gaussian-shaped photons propagating through one-dimensional waveguides and interacting with two-level atoms9,12,13,14,15. However, the restriction to the one-dimensional waveguide hinders their application to spatially two or three-dimensional systems. Havukainen et al.16 conducted numerical simulations of wave packet dynamics where a single photon propagates through an ensemble of two-level atoms laid out in a two-dimensional space. The simulation divides the space into smaller grids and retains all the spatial modes up to the resolution determined by the size of the grids. The two-level atoms are located at the grid points (see the top left panel of Fig. 1a). The dimension of the Hilbert space handled by this simulation exceeds that of the others by several orders of magnitude. The high dimensionality allows this simulation to reproduce a variety of QOD such as reflection and interference of a single photon by mirrors, beamsplitters, and double slits.

All these previous methods address the curse of dimensionality by either limiting the spatial modes and/or the total number of particles. For example, Havukainen et al.16 considered a large number of possible spatial modes, but they treated the dynamics of one photon. The multi-photon system gives rise to characteristic quantum phenomena that involve quantum entanglement. These phenomena are not only important for basic science, but also are the underpinnings of quantum-enabled applications in cryptography, sensing, and imaging17,18,19,20. Polarization is a degree of freedom of photons that is used in many quantum applications due to the availability of means to manipulate this degree of freedom at quantum precision. It is desirable that QOD simulations incorporate polarization.

In this paper, we introduce a numerical method to analyze multi-photon, spatially multi-dimensional QOD. Our method includes the polarization degree of freedom, based on the Hamiltonian in the quantum optical systems proposed by Havukainen et al.16. We construct the time evolution operator of the multi-photon system by composing a group of time evolution operators, each of which acting on a particular photon. This treatment exponentially reduces the dimension of the time evolution operator that needs to be computed, with respect to the number of photons (see “Methods” section for the details). The numerical stability of simulations is improved by implementing a symplectic integration of the QED equations based on the Suzuki–Trotter decomposition. All combined, we succeed to simulate basic one- and two-photon phenomena, namely, the Mach–Zehnder (MZ) interference, Hong–Ou–Mandel (HOM) interference and violation of Bell-CHSH inequality. We use this simulation method to visualize the photon propagation dynamics of these phenomena and to understand the physical origins of the computed results. We also simulate a photon directed toward a scattering object (scatterer) and present the detailed interplay between the detection pattern and the single-photon interference caused by the scatterer. The simulation results are presented in section “Results”, followed by discussions in Section “Discussion”. The details of the present methods and parameters used in the numerical simulations are summarized in the “Methods” section.

Results

Mach–Zehnder interference

The MZ interference is used for a variety of applications in optics, including optical switches21, modulators22, sensors23, and quantum computing24. A typical MZ interferometer uses a set of representative linear optical objects, namely, two beamsplitters (BS1, BS2), two mirrors (M1, M2) and one phase shifter (PS) deployed as shown in Fig. 1a. The BS1 splits an incident beam of light into two beams, one which runs through M1 followed by PS and the other beam through M2. The two beams are then combined by BS2 to produce an interference pattern.

We simulate the MZ interference of a single photon. The optical objects are each implemented by an ensemble of two-level atoms, indicated by a gray filled rectangle in Fig. 1a. The parameters of the two-level atoms are tuned so as to serve as the desired linear optical object (see Table 1 for specific parameters). At \(t=0\), a single photon is generated just left of BS1 directed toward BS1. The probability \(P_{\text {right}}\) that the photon is ejected from the right side of BS2 is determined by the phase shift \(\varphi \) imposed by PS. A simplified theory predicts that \(P_{\text {right}}(\varphi ) = \cos ^2(\varphi /2)\), assuming that a photon propagates in at most two modes at all times with no photons absorbed by the two-level atoms.

Figure 1a shows snapshots of the time evolution in the case of \(\varphi = \pi \). Because the photon is ejected only in the upward direction, the result confirms the solution \(P_{\text {right}}(\pi )=0\). Figure 1b shows a comparison of \(P_{\text {right}}(\varphi )\) simulated by the Suzuki–Trotter decomposition and the Runge–Kutta method used in the present and previous works, respectively (see “Methods” section for the details). The result of using the Suzuki–Trotter decomposition is in a good agreement with the theoretical prediction, despite the fact that more than two modes are involved in the process and photons are absorbed by the two-level atoms at the intermediate time steps. On the other hand, the result of the Runge–Kutta method shows that the probabilities significantly deviate from the theoretical prediction, and some of the values exceed one. Furthermore, even using a shorter time step than that employed in the Suzuki–Trotter method, a numerical instability appears in QOD as shown in the inset of Fig. 1b. We conclude that the present method offers more reliable simulation than previously possible.

Figure 1
figure 1

(a) Snapshots of the simulation of the MZ interference when imposed the phase shift \(\varphi = \pi \). The contour shows the photon number density. The gray lines and filled rectangles correspond to the beamsplitters (BS1, BS2) and mirrors (M1, M2), respectively. The unfilled rectangle corresponds to the phase shifter (PS), which adds the phase-shift \(\exp (i\varphi )\) to the photon. (b) Plot of the probability \(P_{\text {right}}(\varphi )\) obtained by the Suzuki–Trotter (blue) and the Runge–Kutta (orange) method. dt is the time step used in each method. The black dotted curve shows the standard theoretical prediction. The horizontal gray dotted line is drawn at \(P_{\text {right}} = 1\) as a guide for the eye.

Photon detection in the presence of scatterer

Given a practical use of a quantum sensing and imaging17,18, obstacles in a space may scatter photons and affect the detection accuracy. Such a system cannot be described by an idealized theory, where the photonic modes are limited to one or just a few. Here, we demonstrate scattering of a single photon by an obstacle (scatterer), as shown in Fig. 2a, exploiting the simulation capacity of our method for high-dimensional QOD. The scatterer, which is composed of \(4 \times 4\) two-level atoms, is located at the center of the simulation space and is shifted by \(\Delta x\) and \(\Delta y\) in the x and y direction, respectively. A detector is placed at the far right edge of the space, indicated by the gray rectangle. The probability P of the propagated photon being detected is given by the photon number density within the detector region. The error rate is calculated by 1- P. We computed the error rate for various values of the widths of the detector region. In general, we expect that the scatterer should have less effect on the photon as the scatterer moves further away from the optical path. We shall see that this general intuition does not hold.

Figure 2
figure 2

(a) The time evolution of the photon number density with the scattering obstacle located at the center of space. Two typical widths of the detector region are illustrated by the dashed and solid lines. The width between the two dashed lines is narrower and that between the two solid lines is wider. (b) The upper panel shows the error rate as a function of the width of the detector window. The results are obtained by changing \(\Delta x\) but fixing \(\Delta y = 0\). The gray dotted line shows the result without a scatterer. The vertical lines correspond to the typical widths of the detector region. The lower panels show the final state of \(\Delta x=-7.4\) and 11.0. (c) The same as (b) but the plots denote the different values of \(\Delta y\). We set \(\Delta x = 7.4\). The inset shows detailed plots around the region indicated by the black arrow. The lower panels show the final states for \(\Delta y=0.0, 0.6\), and 1.2.

Figure 2b shows the dependence of the error rates on the widths of the detector window. We change \(\Delta x\) but fix \(\Delta y = 0.0\). As a general trend, the error rates monotonously decrease as the width increases. This is because the wider the width of the detector region, the more likely it is to find the photon inside the detector region. Yet, we observe a plateau profile of the error rate in \(\Delta x=11.0\) around the width indicated by the vertical gray solid line. The number densities at the final states are visualized for \(\Delta x=-7.4\) and 11.0 in the lower panels of Fig. 2b. When \(\Delta x=11.0\), the number density has a particular structure, that is caused by an interference of a scattered photon coming from the upper and lower side of the scatterer. This fringe structure gradually disappears by diffusion of the photon number density as the distance to the scatterer increases after passing it, as in the case of \(\Delta x=-7.4\). The plateau profile appears when an edge of the detector region is in the sparse region of the interference fringes. In a sense, the detector “fails” to capture more photons despite increasing its size.

Figure 2c compares the profiles of the error rates by changing \(\Delta y\) values and fixing \(\Delta x=7.4\). As in Fig. 2b, the error rates generally decrease as the width increases. When \(\Delta y\) increases, the error rates decrease because the scatterer moves further away from the optical path. We observe that the order of the error rate curves changes as the detector region width changes (cf. the black arrow). The result shows that there is a range of the widths where the error rate increases when the scatterer moves away from the center of the optical path (also see the inset of Fig. 2c). To understand this behavior, we visualize the final states of \(\Delta y=0.0, 0.6\), and 1.2 as shown in the lower panels of Fig. 2c. In the case of \(\Delta y=0\), the interference fringes almost completely land within the detector region. On the other hand, a shift \(\Delta y\) destroys the fringe structure. Due to the cancellation of the interference, a part of the wave-packet distributes outside the detector region (indicated by the white arrows in the lower panels of Fig. 2c), resulting in the higher error rate than the \(\Delta y=0\) case.

Hong–Ou–Mandel interference

The Hong–Ou–Mandel (HOM) interference is a quintessential quantum effect of two indistinguishable photons25,26, which cannot be analyzed by simulations based on classical electrodynamics or QOD simulation limited to a single-photon states. Figure 3a shows a minimal model for the HOM interference, where two photons characterized by \(\xi \) and \(\eta \) indices are simultaneously injected to the ports of a beamsplitter. The beamsplitter divides a injected photon in half into transmitted and reflected parts. In QED, the injected state is expressed by

$$\begin{aligned} {|{1_{\xi }, 1_{\eta }}\rangle } = \hat{a}^{\dagger }_{\xi } \hat{a}^{\dagger }_{\eta } {|{{0}}\rangle }, \end{aligned}$$
(1)

where \(\hat{a}^{\dagger }\) is the creation operator of a photon. The operator of the beamsplitter \(V_{\text {BS}}\) performs as,

$$\begin{aligned} V_{\text {BS}} \hat{a}_\xi ^\dagger V_{\text {BS}}^\dagger = \frac{1}{\sqrt{2}}(\hat{a}_\xi ^\dagger + \text{i}\hat{a}_\eta ^\dagger ) \\ V_{\text {BS}} \hat{a}_\eta ^\dagger V_{\text {BS}}^\dagger = \frac{1}{\sqrt{2}}(\hat{a}_\eta ^\dagger + \text{i}\hat{a}_\xi ^\dagger ). \end{aligned}$$

Therefore, the outgoing state from the beamsplitter becomes

$$\begin{aligned} V_{\text {BS}} \otimes V_{\text {BS}} {|{1_{\xi }, 1_{\eta }}\rangle } = \frac{\text{i}}{\sqrt{2}}({|{2_\xi , 0_\eta }\rangle } + {|{0_\xi , 2_\eta }\rangle }) . \end{aligned}$$
(2)

This result indicates that the two photons are always ejected together from either right (\(\xi \)) or upper (\(\eta \)) outlet port. In other words, the probability that each photon is emitted in a separate port disappears by quantum interference of the two photons.

Figure 3
figure 3

(a) Schematic of a setup for HOM interference. The beamsplitter is located at the center of the space tilted at 45 degrees. The initial position of the \(\xi \) photon in the x direction is shifted by \(\Delta x\). (b) Time evolution of the probability distribution of the two photons being found at the same position, i.e., bunching probability distribution. (c) Simulation result and analytical solution in Eq. (4) of the HOM interference. The vertical axis indicates the coincidence probability, namely, the probability of detecting a photon simultaneously in the two separate output directions (up and right). The inset panels show the bunching probability distribution within the white rectangle in (b).

This HOM interference is simulated by the model shown in Fig. 3a. The calculated quantum state is denoted by \({|{\Phi (\Delta x, t)}\rangle }\), where \(\Delta x\) is a shift in the x direction of the initial position of the \(\xi \) photon. First, we visualize the spatial distribution of the probability of finding two photons at a given location at different times of the evolution. This bunching probability can be calculated by \(\rho (\Delta x, t, \textbf{r}) = |{\langle {1_\textbf{r}}|}{\langle {1_\textbf{r}| \Phi (\Delta x, t)}\rangle }|^2\), where \({|{1_\textbf{r}}\rangle }{|{1_\textbf{r}}\rangle }\) is a state in which two photons are in the same position. Figure 3b shows the dynamics of \(\rho (0, t, \textbf{r})\). Before the two photons reach at the beamsplitter (\(t < 17\)), there is almost no value of the bunching probability because they are far from each other. After the photons pass through the beamsplitter, we observe that the bunching appears and then the distribution is separated into two portions that travel in the right and upper direction. Then, we perform this numerical experiment for different values of \(\Delta x\). We remove the beamsplitter in Fig. 3a and calculate the two-photons system. This free propagating state is denoted by \({|{\Phi _0 (t)}\rangle }\) in which the two photons are observed separately in the different outlets, which we call the coincidence probability. The coincidence probability can be measured by

$$\begin{aligned} p(\Delta x) = |{\langle {\Phi _0 (T)|\Phi (\Delta x, T)}\rangle }|^2, \end{aligned}$$
(3)

where time \(T = 45\) is chosen to assure that the wave-packets have separated enough after passing through the beamsplitter. Figure 3c shows the profile of \(p(\Delta x)\). Around \(\Delta x = 0\), the coincidence probability is almost zero which corresponds to the theoretical result in Eq. (2). Increasing \(\Delta x\), we observe a dip in the coincidence probability. This HOM dip was observed in experiments as an evidence of the quantum nature of light25,26. The shape of the dip is characterized by an overlap of the two photons. In fact, a theory of the HOM interference offers an analytical solution25.

$$\begin{aligned} p(\Delta x) = \frac{1}{2} \Bigl ( 1-\exp \Bigl (- \frac{\Delta x^2}{2\sigma ^2} \Bigr )\Bigr ), \end{aligned}$$
(4)

where \(\sigma \) is the Gaussian width of the photon. This analytical solution, which is plotted in Fig. 3c, shows a good agreement with the numerical one.

Violation of Bell-CHSH inequality

In addition to the multi-photon states, the photon polarization degree of freedom is included in the present method. The polarization is commonly chosen in quantum experiments, including the photonic experiments confirming the violation of Bell-CHSH inequality27,28. The CHSH inequality provides a limit on a particular type of correlations of two separated systems, should their behavior be determined by classical mechanics. Quantum mechanics, however, violates the inequality under specific conditions. This violation was successfully confirmed by photonic experiments29,30,31 and various physical systems including atoms32 and superconducting qubits33.

Here, we model the experiment performed by Aspect et al.34, as shown in Fig. 4a,b. We deploy optical objects that rotate the polarization of the photon passing through them. One of the polarization rotators shifts by \(\theta _{\textbf{a}}\) or \(\theta _{\textbf{a}'}\), while the other by \(\theta _{\textbf{b}}\) or \(\theta _{\textbf{b}'}\). Two photons are directed to the two rotators individually, and then the horizontal and vertical components are spatially separated by the polarization beamsplitters. Given the rotation angles, we observe a correlation of the polarizations of the two photons as defined by

$$\begin{aligned} S(\theta ) = E(\theta _{ \textbf{a}},\theta _{\textbf{b}}) + E(\theta _{\textbf{a}'},\theta _{\textbf{b}}) + E(\theta _{\textbf{a}'},\theta _{\textbf{b}'}) - E(\theta _{\textbf{a}},\theta _{\textbf{b}'}), \end{aligned}$$
(5)

where \(E(\theta _{\textbf{a}},\theta _{\textbf{b}}) = P_{HH}(\theta _{\textbf{a}}, \theta _{\textbf{b}}) + P_{VV}(\theta _{\textbf{a}}, \theta _{\textbf{b}}) - P_{HV}(\theta _{\textbf{a}}, \theta _{\textbf{b}}) - P_{VH}(\theta _{\textbf{a}}, \theta _{\textbf{b}})\). The probability \(P_{pp'}(\theta _{\textbf{a}}, \theta _{\textbf{b}})\) (\(p,p' \in \{H,V\}\)) is the probability that a photon is detected in the p-polarization outlet in the left and, simultaneously, another photon detected in the \(p'\)-polarization outlet, when the rotation angles are set at \(\theta _{\textbf{a}}\) and \(\theta _{\textbf{b}}\). According to the Bell-CHSH inequality, \(S(\theta )\) must range \(-2 \le S(\theta ) \le 2\) if the local realism is correct. However, if we prepare two photons that are in a maximally entangled state, quantum mechanics asserts that

$$\begin{aligned} P_{pp'} (\theta _{\textbf{a}}, \theta _{\textbf{b}}) = \frac{1}{2} |\delta _{p,p'}- \cos ^2\theta _{\textbf{ab}}|, \end{aligned}$$
(6)

where \(\theta _{\textbf{ab}}= |\theta _{\textbf{a}} - \theta _{\textbf{b}}|\) and \(\delta \) is the Kronecker delta35. Equation 6 leads to \(E(\theta _{\textbf{a}},\theta _{\textbf{b}}) = \cos 2\theta _{\textbf{ab}}\). When setting the angles at \(\theta _{\textbf{ab}} = \theta _{\mathbf {a'b}} = \theta _{\mathbf {a'b'}} = \theta \) (see also the inset of Fig. 4c), and hence \(\theta _{\mathbf {ab'}} = 3\theta \), Eq. (5) becomes

$$\begin{aligned} S(\theta ) = 3\cos 2\theta - \cos 6\theta , \end{aligned}$$
(7)

in the case of the maximally entangled state. Equation 7 breaks the inequality \(-2 \le S(\theta ) \le 2\) as shown by the blue solid line of Fig. 4c.

Figure 4a shows the dynamics of the number density of two photons prepared in a maximally entangled state. Each photon propagates to the left and right direction, as indicated by the white arrows. The angles of the two polarization rotators are set at \(\theta _\textbf{a}=0\) and \(\theta _\textbf{b}=\pi /2\). The initial state is given by \({|{\Phi (t=0)}\rangle }=({|{H}\rangle }{|{H}\rangle }+{|{V}\rangle }{|{V}\rangle })/\sqrt{2}\), where \({|{H}\rangle }{|{H}\rangle }\) (\({|{V}\rangle }{|{V}\rangle }\)) denotes the two photons polarized in the horizontal (vertical) direction. Figure 4b shows the case of a product state \({|{\Phi (t=0)}\rangle }={|{H}\rangle }{|{H}\rangle }\). The photons of the product change their polarization angle by passing through the polarization rotator, while not for those of the maximally entangled state. This invariance can be explained by computing the state of one of the photons when the initial state of the two photons is \({|{\Phi }\rangle } = \frac{{|{H}\rangle }{|{H}\rangle } + c{|{V}\rangle }{|{V}\rangle }}{\sqrt{1+c^2}}\), where \(0 \le c \le 1\). The density matrix corresponding to the two photons is

$$\begin{aligned} \hat{\rho }(c) = {|{\Phi }\rangle }{\langle {\Phi }|}. \end{aligned}$$
(8)

A partial trace of the density matrix on the right photon yields the reduced density matrix

$$\begin{aligned} \hat{\rho }'(c) = \sum _p {\langle {p}|} \hat{\rho }(c) {|{p}\rangle }= \frac{1}{1+c^2} \Bigl ( {|{H}\rangle }{\langle {H}|} + c^2 {|{V}\rangle }{\langle {V}|} \Bigr ). \end{aligned}$$

If \(c=1\) which corresponds to the maximally entangled state, \(\hat{\rho }'(1) = \hat{I}/2\) where \(\hat{I}\) is the identity operator. Considering a polarization rotation \(\hat{U}\) that operates \(\hat{U} \rho '(c) \hat{U}^{\dagger }\), it is obvious that the polarization rotator does not change the partial state of this photon. On the other hand, we have \(\hat{\rho }'(0) = {|{H}\rangle }{\langle {H}|}\), thus the state of the photon of the product state is changed by the operation of \(\hat{U}\). These results are visualized in Fig. 4a,b.

Figure 4c shows the simulated \(S(\theta )\). The results of the maximally entangled state (the blue plots) show a good agreement with the theoretical prediction (the blue solid line) of Eq. (7). The violations of the Bell-CHSH inequality appear around \(\theta =\pi /8,\ 3\pi /8\). In addition, we calculate \(S(\theta )\) by changing the parameter c of the initial state as in Eq. (8). The violations occur if \(c \ge 0.25\).

To obtain deeper insights into the difference between the maximally entangled and product states, we visualize \(S(\theta )\) in Fig 4c. Namely, we first define

$$\begin{aligned} P_{pp'}(\theta _{\textbf{a}}, \theta _{\textbf{b}}, \textbf{r}) = \frac{1}{2} \sum _{\textbf{r}'} | \left( {\langle {1_{\textbf{r},p}}|}{\langle {1_{\textbf{r}',p'}}|} + {\langle {1_{\textbf{r}',p}}|}{\langle {1_{\textbf{r},p'}}|} \right) {|{\Phi (t)}\rangle }|^2 , \end{aligned}$$

and \(E(\theta _{\textbf{a}},\theta _{\textbf{b}}, \textbf{r}) = P_{HH}(\theta _{\textbf{a}}, \theta _{\textbf{b}}, \textbf{r}) + P_{VV}(\theta _{\textbf{a}}, \theta _{\textbf{b}}, \textbf{r}) - P_{HV}(\theta _{\textbf{a}}, \theta _{\textbf{b}}, \textbf{r}) - P_{VH}(\theta _{\textbf{a}}, \theta _{\textbf{b}}, \textbf{r})\). The basis \({|{1_{\textbf{r},p}}\rangle }\) is a state in which a photon with the polarization p is at the position r. Accordingly, a correlation density is defined by

$$\begin{aligned} S(\theta , \textbf{r}) = E(\theta _{\textbf{a}},\theta _{\textbf{b}}, \textbf{r}) + E(\theta _{\textbf{a}'},\theta _{\textbf{b}}, \textbf{r}) + E(\theta _{\textbf{a}'},\theta _{\textbf{b}'}, \textbf{r}) - E(\theta _{\textbf{a}},\theta _{\textbf{b}'}, \textbf{r}). \end{aligned}$$
(9)

Note that we can retrieve \(S(\theta )\) by \(S(\theta ) = \sum _\textbf{r}S(\theta ,\textbf{r})\). The distribution of \(S( \theta ,\textbf{r})\) for the maximally entangled state is found to be invariant with respect to \(\theta \) except for its magnitude. This result is relevant to Fig. 4a in which the number density apparently does not change by the polarization rotators due to the fact that the reduced density matrix becomes the identity operator. Therefore, the correlations between the sets of \(\theta _ {\textbf{a}}\) and \(\theta _{\textbf{b}}\) tend to be magnified, resulting in clear violations of the inequality at particular angles. On the other hand, since the product state is changed by the polarization rotator as shown in Fig. 4b, terms composed of the correlations tend to cancel each other. This fact prevents \(S(\theta )\) to exceed the limit of the local realism. In short, the present method reproduces the theory and experimental results, and its visualization facilitates understanding of the mechanism.

Figure 4
figure 4

(a) Time evolution of two photons in the Bell-CHSH experiment, in the case of the maximally entangled state. The left and right panel show the photon number density of the horizontal and the vertical polarization component, respectively. The filled and unfilled rectangles represent the polarization beamsplitter (PBS) and the polarization rotator, respectively. The angles of the two polarization rotators are \(\theta _{\textbf{a}} = 0\), \(\theta _{\textbf{b}} = \pi /2\). (b) The same as (a) but the input photon is a product state. (c) The correlation value \(S(\theta )\) in Eq. (5). The horizontal dashed gray lines indicate the limit of the local realism. The inset explains a configuration of the angles set in this simulation: \(\theta _{\textbf{a}}=0\) and \(\theta _{\textbf{ab}} = \theta _{\mathbf {a'b}} = \theta _{\mathbf {a'b'}} = \theta \). The upper panels show the correlation densities \(S(\theta , \textbf{r})\) of the maximally entangled and product states at \(\theta =0, \pi /8, \pi /4\).

Discussion

The curse of dimensionality does not exist if the system is modeled and solved by classical electrodynamics. Many aspects of optics can be analyzed by classical methods of electromagnetic fields, such as method of moments36, finite-difference time-domain methods37,38,39, finite-difference frequency-domain methods40, and finite element method41. These techniques are based on the Maxwell equations that approximate light-matter interactions as a dissipation of the electromagnetic field or as spatially and spectrally nonuniform permittivity and/or permeability (so-called macroscopic treatment). However, the classical framework cannot capture multi-photon phenomena (see the recent review42), such as quantum interference and quantum entanglement, which are demonstrated in this study. By modeling a three-level atomic system, our numerical scheme can simulate nonlinear optical effects such as spontaneous parametric down conversion. However, the curse of dimensionality would reappear because a direct product form of the time evolution operator is no longer applicable. We will tackle this in a future work.

While any QOD simulation has to contend with some omission of details when used to understand experiments, visualization of quantum dynamics of complex systems, as treated in this paper, is a unique advantage of numerical simulation, not present in experiments. A quantum state changes itself in principle when observed. It is, therefore, significantly resource intensive to experimentally trace the time-evolution process of photons propagating through complex optical setups. The presented high-dimensional QOD would be useful to reveal the intermediate process in detail. For instance, the visualizations of Section “Photon detection in the presence of scatterer" helped us to clarify the cause of the behavior of the error rate. This flexible and accurate simulation of the high-dimensional QOD should also aid in creating a viable minimal model that guides designing experiments and applications that exploit quantum states of light.

Methods

We explain the present method in a two-dimensional space that spans over \( 0 \le x \le L_x\) and \( 0 \le y \le L_y\). The space is discretized by numbers of grids (\(M_x\), \(M_y\)), and its boundaries are periodic. We set \(\hbar = c = 1\) in the following formulations for a notational simplicity.

Single-photon system

We begin with a theoretical framework of the single-photon simulation as introduced by16 (also see the Supplemental Information for the details). The system consists of \(N_A\) two-level atoms (we write “atom” in the following for the simplicity) and one photon that has a wave-number vector \(\textbf{k}\). The total Hamiltonian is

$$\begin{aligned} \hat{h}= & {} \hat{h}_0 + \hat{h}_I, \end{aligned}$$

where

$$\begin{aligned} \hat{h}_0= & {} \sum _{\textbf{k}} \omega _{\textbf{k}} \hat{a}_{\textbf{k}}^{\dagger } \hat{a}_{\textbf{k}} + \sum _{j=1}^{N_A} 2 \omega _j \hat{a}_{j}^{\dagger } \hat{a}_{j}, \end{aligned}$$
(10)

and \(\hat{a}\) is an annihilation operator. The frequencies \(\omega _{\textbf{k}}\) and \(\omega _{j}\) indicate eigenenergies of the corresponding photon mode and atom, respectively. The Hamiltonian \(\hat{h}_I\) represents a dipole–dipole interaction between the photon and atoms,

$$\begin{aligned} \hat{h}_I= & {} \sum _{j, \textbf{k}} ( g(j, \textbf{k}) \hat{a}_{j}^{\dagger } \hat{a}_{\textbf{k}} + g^*(j, \textbf{k}) \hat{a}_{\textbf{k}}^{\dagger } \hat{a}_{j} ) \end{aligned}$$
(11)
$$\begin{aligned} g(j, \textbf{k})= & {} -\frac{\text{i}}{\sqrt{2}L} \sqrt{\omega _j} D_j e^{\text{i}\textbf{k}\cdot \textbf{r}_j}, \end{aligned}$$
(12)

where \(L= \sqrt{L_x L_y}\). The parameter \(D_j\) sets the strength of the dipole–dipole interaction, and the vector \(\textbf{r}_j\) the position of the jth atom. This interaction makes the constituent atoms play a role of linear optical objects such as mirror, beamsplitter, and scatterer by controlling the parameters \(\omega _j\) and \(D_j\).

A quantum state of this system is restricted so that the total number of excitations is one, namely,

$$\begin{aligned} {|{\phi (t)}\rangle }= & {} \sum _{\textbf{k}} c(t,\textbf{k}) {|{1_{\textbf{k}}}\rangle } + \sum _{j=1}^{N_A} c_{j}(t) {|{1_{j}}\rangle }, \end{aligned}$$

where \(c(t, \textbf{k})\) and \(c_{j}(t)\) are the complex amplitudes satisfying \(\sum _{\textbf{k}} |c(t, \textbf{k})|^2 + \sum _{j} |c_{j}(t)|^2 = 1\). The atoms are deployed at the grid lattice points to form necessary optical objects. The indices \(1_{\textbf{k}}\) and \(1_j\) in the kets denote one photon of \(\textbf{k}\) mode and one excitation of a j-th atom, respectively. Namely, operations of \(\hat{a}_\textbf{k}\) to the bases are

$$\begin{aligned} \hat{a}_\textbf{k}{|{1_{\textbf{k}}}\rangle }={|{0}\rangle }, \ \ \ \hat{a}^{\dagger }_\textbf{k}{|{0}\rangle } = {|{1_{\textbf{k}}}\rangle }, \end{aligned}$$

and those of \(\hat{a}_j\) are the same manner. In addition,

$$\begin{aligned} \hat{a}^{\dagger }_j \hat{a}^{\dagger }_\textbf{k}{|{0}\rangle } = \hat{a}^{\dagger }_\textbf{k}\hat{a}^{\dagger }_j {|{0}\rangle } = 0, \end{aligned}$$

due to the restriction of the total number of excitations to one.

The Schr\(\ddot{\text {o}}\)dinger equation and the solution of the time evolution are written by

$$\begin{aligned} \text{i}\frac{\partial {|{\phi (t)}\rangle }}{\partial t}= & {} \hat{h} {|{\phi (t)}\rangle } \end{aligned}$$
(13)
$$\begin{aligned} {|{\phi (t)}\rangle }= & {} \exp (- \text{i}\hat{h} t) {|{\phi (0)}\rangle }. \end{aligned}$$
(14)

Polarization degrees of freedom

The method is extended simply by adding a polarization index p that specifies the horizontal and vertical polarization by H and V, respectively. The state of the single-photon system is expressed by

$$\begin{aligned} {|{\phi (t)}\rangle }= & {} \sum _{p \in \{H, V\}}{|{\phi _p(t)}\rangle } \nonumber \\ {|{\phi _p(t)}\rangle }= & {} \sum _{\textbf{k}} c_p(t,\textbf{k}) {|{1_{\textbf{k}, p}}\rangle } + \sum _{j=1}^{N_A} c_{j, p}(t) {|{1_{j, p}}\rangle }. \end{aligned}$$
(15)

The Hamiltonians \(\hat{h}_0\) and \(\hat{h}_I\) in Eqs. (10) and (11) can be extended by just replacing \(\hat{a}_{\textbf{k}} \rightarrow \hat{a}_{\textbf{k},p}, \hat{a}_{j} \rightarrow \hat{a}_{j,p}\). Note that these Hamiltonians do not influence the polarization degrees of freedom. The interaction Hamiltonian \(\hat{h}_I\) becomes

$$\begin{aligned} \hat{h}_I= & {} \sum _{p, j, \textbf{k}} ( g_p(j, \textbf{k}) \hat{a}_{j,p}^{\dagger } \hat{a}_{\textbf{k},p} + g_p^*(j, \textbf{k}) \hat{a}_{\textbf{k},p}^{\dagger } \hat{a}_{j,p} ) \end{aligned}$$
(16)
$$\begin{aligned} g_p(j, \textbf{k})= & {} -\frac{\text{i}}{\sqrt{2}L} \sqrt{\omega _{j}} D_{j,p} e^{\text{i}\textbf{k}\cdot \textbf{r}_j}, \end{aligned}$$
(17)

where \(D_{j,p}\) denotes the strength of the dipole interaction between the j-th atom and the photon mode p. Tuning \(D_{j,p}\) creates optical objects that change the polarization. For example, a polarization beamsplitter reflects only the vertical polarization but transmits the horizontal one. It can be created by setting \(\omega _{j}\) and \(D_{j,V}\) at appropriate values for a role of mirrors, but \(D_{j,H}=0\). A polarization rotator can be constructed by a rotated half wave plate which introduces \(\pi \) phase shift on the polarization directed toward the slow axis of the wave plate. This can be achieved by using the basis of the fast and slow axes of the wave plate \(\{ F,S\}\), as

$$\begin{aligned} {|{1_{\textbf{k}, F}}\rangle }&= \cos \Theta {|{1_{\textbf{k}, H}}\rangle } + \sin \Theta {|{1_{\textbf{k}, V}}\rangle }, \ {|{1_{\textbf{k}, S}}\rangle } = -\sin \Theta {|{1_{\textbf{k}, H}}\rangle } + \cos \Theta {|{1_{\textbf{k}, V}}\rangle }, \\ {|{1_{j, F}}\rangle }&= \cos \Theta {|{1_{j, H}}\rangle } + \sin \Theta {|{1_{j, V}}\rangle }, \ {|{1_{j, S}}\rangle } = -\sin \Theta {|{1_{j, H}}\rangle } + \cos \Theta {|{1_{j, V}}\rangle }. \end{aligned}$$

The basis transformation of the single-photon system is

$$\begin{aligned} \sum _{\textbf{k}, p' \in \{F,S\}} {|{1_{\textbf{k}, p'}}\rangle } {\langle {1_{\textbf{k}, p'}|\phi (t)}\rangle } + \sum _{j, p' \in \{F,S\}} {|{1_{j, p'}}\rangle } {\langle {1_{j, p'}|\phi (t)}\rangle }. \end{aligned}$$
(18)

Then, \(\Theta \) is set as \(\Theta = \theta _{\text {rot}}/2 + \theta _{\text {pol}}\) depending on a rotation angle \(\theta _{\text {rot}}\) given by the polarization rotator, where \(\theta _{\text {pol}}\) denotes an angle of the linear polarization of the input photon against a direction of the horizontal polarization. \(\omega _{j}\) and \(D_{j,S}\) are set at appropriate values to add \(\pi \) phase shift on the slow axis component, while \(D_{j,F}=0\).

This scheme for the polarization is examined by a single-photon simulation. The time evolution is solved by the Suzuki–Trotter decomposition which will be explained in the Section “Time evolution by Suzuki–Trotter decomposition”. Figure 5a shows the system where the initial polarization of a photon is H, and the photon is directed toward a polarization rotator. In this case, the polarization is rotated by an angle \(\theta _{\text {rot}}=\pi /4\). Then, only the V component is reflected to the upward by the polarization beamsplitter, while the H component passes through the object. We observe the probabilities of the V components as a function of \(\theta _{\text {rot}}\), as shown in Fig. 5b. The calculated probabilities are well-fitted by the behavior of an ideal polarization rotator \(\sin ^2 \theta _{\text {rot}}\). These results confirm that the quantum state including the polarization and the relevant optical objects used in Section “Violation of Bell-CH SH inequality” work as intended.

Figure 5
figure 5

(a) The result of the simulation with the polarization rotator and the polarization beamsplitter (PBS). We set the rotation angle of the polarization rotator as \(\theta _{\text{rot}} = \pi /4\). The polarization rotator consists of 2048 atoms composed with 16 atomic layers, and its parameters are set as \(D_{j,S}=0.56\) and \(\omega _{j}=1.2\). PBS consists of 1185 atoms composed with 8 atomic layers, and its parameters are set as \(D_{j,V}=0.56\) and \(\omega _{j}=5.0\). The cavity lengths are \(L_x=20\pi \) and \(L_y=10\pi \), and the grids are cut by \(512 \times 256\). The Gaussian width of the photon is \(\sigma = 2.0\). The initial position and wave number of the photon are \(\bar{\textbf{r}} = (2.0, L_y/2)\) and \(\bar{\textbf{k}}=(10.0, 0)\). (b) Plot of the probability \(P_V(\theta_{\text{rot}})\) which is the probability of the photon polarized in the vertical direction at the end of simulation. The solid line is a theoretical prediction assuming an idealized PBS.

Time evolution by Suzuki–Trotter decomposition

The previous study16 rewrites the Schr\(\ddot{\text {o}}\)dinger equation in Eq. (13) in the interaction picture and numerically solves it by the fourth-order Runge–Kutta method. We have decided to formulate the Hamiltonian in such a way to apply the Suzuki–Trotter decomposition as it is known that the Suzuki–Trotter decomposition has numerically advantages in computing the time evolution of a Hamiltonian system43,44,45,46,47,48,49. The time evolution operator in Eq. (14) can be approximated by the Suzuki–Trotter decomposition, as

$$\begin{aligned} e^{-\text{i}\hat{h}\delta t }= & {} e^{-\text{i}(\hat{h}_0 + \hat{h}_I)\delta t } \nonumber \\\sim & {} e^{-\text{i}\hat{h}_I \delta t /2} e^{-\text{i}\hat{h}_0 \delta t } e^{-\text{i}\hat{h}_I \delta t /2}, \end{aligned}$$
(19)

where \(\delta t\) is a time step of the simulation. Each Hamiltonian is diagonalized to compute the time evolution operator. The \(\hat{h}_0\) is already diagonal in the wave-number basis \(\textbf{k}\). To diagonalize \(\hat{h}_I\), it is numerically convenient to transform the interaction Hamitonian \(\hat{h}_I\) from the basis \(\textbf{k}\) into the position basis \(\textbf{r}\)

$$\begin{aligned} \hat{h}_I = \sum _{p, j} (W_{j,p} \hat{a}_{j,p}^{\dagger } \hat{a}_{\textbf{r}_j, p} + W^{*}_{j,p} \hat{a}_{j,p} \hat{a}^{\dagger }_{\textbf{r}_j, p} ), \end{aligned}$$
(20)

because by using a Fourier transformation the term in Eq. (11) becomes

$$\begin{aligned} \sum _{\textbf{k}} g_p(j, \textbf{k}) \hat{a}^{\dagger }_{j,p} \hat{a}_{\textbf{k}, p}= & {} -\frac{\text{i}}{\sqrt{2}L} \sqrt{\omega _j} D_{j,p} \hat{a}_{j,p}^{\dagger } \sum _{\textbf{k}} e^{\text{i}\textbf{k}\cdot \textbf{r}_j} \hat{a}_{\textbf{k}, p} \\= & {} W_{j,p} \hat{a}_{j, p}^{\dagger } \hat{a}_{\textbf{r}_j, p}, \end{aligned}$$

where \(W_{j,p} = -\text{i}D_{j,p} \sqrt{M \omega _{j}}/\sqrt{2} L\). \(M = M_x M_y\) is the number of grids. The operation of \(\hat{a}_{\textbf{r}, p}\) is

$$\begin{aligned} \hat{a}_{\textbf{r}, p} {|{1_{\textbf{r}, p}}\rangle }={|{0}\rangle }, \ \ \ \hat{a}^{\dagger }_{\textbf{r},p} {|{0}\rangle } = {|{1_{\textbf{r}, p}}\rangle }. \end{aligned}$$

As seen in Eq. (20), \(\hat{h}_I\) exchanges the photon and the excitation of the atom located at the same position. This compact representation thanks to the \(\textbf{r}\) basis is advantageous in the numerical diagonalization. In fact, multiplying \({|{\phi }\rangle }\) in Eq. (15) gives

$$\begin{aligned} {\langle {1_{j,p}}|} \hat{h}_I {|{\phi (t)}\rangle }= & {} W_{j,p} c_p(t, \textbf{r}_j) \\ {\langle {1_{\textbf{r}_j,p}}|} \hat{h}_I {|{\phi (t)}\rangle }= & {} W_{j,p}^{*} c_{j,p}(t). \end{aligned}$$

By using matrix representation, this is equivalent to

$$\begin{aligned} \hat{h}_I \vec {\phi }_p(t)= & {} \begin{pmatrix} 0 &{} W_{j,p}^* \\ W_{j,p} &{} 0 \end{pmatrix} \begin{pmatrix} c_p(t,\textbf{r}_j) \\ c_{j,p}(t) \end{pmatrix} \\= & {} V^{-1} \begin{pmatrix} -\text{i}W_{j,p} &{} 0 \\ 0 &{} \text{i}W_{j,p} \end{pmatrix} V \begin{pmatrix} c_p(t,\textbf{r}_j) \\ c_{j,p}(t) \end{pmatrix} \end{aligned}$$

where \( V = 2^{-1/2} \begin{pmatrix} 1 &{} -\text{i}\\ 1 &{} \text{i}\end{pmatrix} \) is a unitary matrix and we used the fact that \(W_{j,p}^* = -W_{j,p}\). Therefore, the time evolution can be operated, as

$$\begin{aligned} e^{-\text{i}\hat{h}_I \delta t} \vec {\phi }_p(t)= & {} V^{-1} \begin{pmatrix} e^{- W_{j,p} \delta t} &{} 0 \\ 0 &{} e^{ W_{j,p} \delta t} \end{pmatrix} V \begin{pmatrix} c_p(t,\textbf{r}_j) \\ c_{j,p}(t) \end{pmatrix}. \end{aligned}$$

We assessed a numerical performance of the Suzuki–Trotter decomposition by a simple single-photon simulation without the polarization degree of freedom. As shown in Fig. 6a, the injected photon collides with the tilted mirror at about \(t=10\) and is reflected upwards. Then, due to the periodic boundary condition, the photon emerges from the lower region and is reflected by the mirror again at about \(t=35\) to go in the right direction. Figure 6b shows the trajectories of the probability \({\langle {\phi (t)|\phi (t)}\rangle }\) that ideally should remain 1 all the time. The result obtained by the previous scheme based on the Runge–Kutta method increases significantly above 1. On the other hand, the present scheme keeps the probability at 1, even with a larger time step. This is a benefit of the Suzuki–Trotter decomposition in Eq. (19) that uses only unitary operators. Figure 6c shows the total energy of the quantum state. By using the previous scheme, the total energy increases and violates the law of energy conservation. The energy trajectory by the present scheme shows small deviations from the initial energy at the times when the photon interacts with the mirror. Afterwards, however, the energy recovers to the initial energy, and the energy conservation tends to be maintained in the dynamics. Such a favourable feature is known as the result of a symplectic condition the Suzuki–Trotter decomposition has46,47. The above observations suggest that the time step \(\delta t = 0.1\) is sufficiently small to justify the approximation of Eq. (19). Although an error of a time step in the second-order Suzuki–Trotter decomposition is an order of \(\delta t^3\) which is larger than that of the fourth-order Runge–Kutta method (\(\delta t^5\)), its property of the energy conservation hinders the accumulation of the error in the long-time dynamics50, making the method preferable. To keep the error of the Runge–Kutta method comparable to that of the Suzuki–Trotter method, a significantly smaller time step than that used in the Suzuki–Trotter method is required (see Fig. 6c). Such a small time step leads to the longer computational time for the Runge–Kutta method. The time evolution by the Suzuki–Trotter decomposition significantly improves stability of the calculation, which gives a reliable quantitative evaluation by the QOD simulation.

Figure 6
figure 6

(a) Schematics of a test system. The space lengths are \(L_x=L_y=10\pi \) and the grids are \(256 \times 256\). The boundary is periodic. The mirror consists of 1,584 atoms (\(D_j=0.5, \omega _j=2.5\)), and the width of mirror is composed of 8 atomic layers. The mirror denoted by “M” is located at the center of space with tilted at 45 degrees. The initial position and wave number of the injected photon are \(\bar{\textbf{r}} = (5.0, L_y/2)\) and \(\bar{\textbf{k}}=(5.0, 0)\). The width is \(\sigma = 1.0\). Trajectories of (b) probability of the quantum state defined by \({\langle {\phi (t)|\phi (t)}\rangle }\) and (c) total energy \({\langle {\phi (t)}|} \hat{h}{|{\phi (t)}\rangle }\). The present method using Suzuki–Trotter decomposition is compared with the method used in16, namely, the fourth-order Runge–Kutta in the interaction picture.

Multi-photon system

For notational simplicity, we omit the polarization index p, since the inclusion of p can be done by replacing \(\textbf{r}\rightarrow \textbf{r}, p\) and \(j \rightarrow j, p\). When naively written, an N-photon state without the polarization is

$$\begin{aligned} {|{\Phi (t)}\rangle } = \sum _{\textbf{r}_1, \cdots \textbf{r}_N} c(t, \textbf{r}_1, \cdots \textbf{r}_N) {|{1_{\textbf{r}_1}}\rangle } \cdots {|{1_{\textbf{r}_N}}\rangle } + \sum _{j} c_{j}(t) {|{1_{j}}\rangle }. \end{aligned}$$

A straightforward updating of the coefficients \(c(t, \textbf{r}_1, \textbf{r}_2, \cdots \textbf{r}_N)\) would require to represent the time evolution operator as an \(O(M^N \times M^N)\) matrix, as the dimension of the Hilbert space of the N-photon states in M grids is \(O(M^N)\). This can be reduced if the time evolution operator can be diagonalized but still requires manipulation of \(O(M^N)\) elements.

To expedite the calculation, we exploit the fact that N-partite states such as \({|{\Phi (t)}\rangle }\) can be expressed with a fewer number of terms with a suitable choice of local states51. In addition our simulation only use the atoms to mimic linear optical objects such as mirrors and beamsplitters. These optical objects only need to reproduce their appropriate output electromagnetic wave for a given incoming wave. The atoms can effectively induce interactions between photons, but linear optical elements do not exhibit such photon-photon interaction. Based on this intuition, we simulate the time evolution of each photon separately neglecting the presence of the other photons in doing so. More precisely, we consider N atoms virtually located at the same position \(\textbf{r}_j\), which we call virtual atoms, and let the N atoms only interact with their respective partner photon to simulate N-photon states. This treatment limits interaction \(\hat{h}_I\) within each single-photon system. Our N-photon state becomes

$$\begin{aligned} {|{\Phi (t)}\rangle }= & {} \sum _{\xi _1, \cdots \xi _N} c_{\xi _1, \cdots \xi _N} {|{\phi _{\xi _1}(t)}\rangle } \cdots {|{\phi _{\xi _N}(t)}\rangle } \nonumber \\ {|{\phi _\xi (t)}\rangle }= & {} \sum _{\textbf{r}} c_\xi (t,\textbf{r}) {|{1_{\textbf{r}}}\rangle } + \sum _{j=1}^{N_A} c_{\xi , j}(t) {|{1_{j}}\rangle }, \end{aligned}$$
(21)

where \(\xi _n\) is a sets of the properties of n-th photon. Deviation of this treatment from the true N-photon evolution occurs when two photons are present at the same location and an atom located at that point absorbs the photons. In our simulation, photon densities are kept sufficiently low to suppress this error. These tricks render a time evolution operator of the N-photon system to be a direct product form as

$$\begin{aligned} \hat{U}(t) = \exp (- \text{i}\hat{h} t) \otimes \cdots \otimes \exp (- \text{i}\hat{h} t), \end{aligned}$$

and the time evolution of the multi-photon system is written as,

$$\begin{aligned} {|{\Phi (t)}\rangle }&= \hat{U}(t) {|{\Phi (0)}\rangle } \\&= \sum _{\xi _1, \cdots \xi _N} c_{\xi _1, \cdots \xi _N} \left[ \exp (- \text{i}\hat{h} t){|{\phi _{\xi _1}(0)}\rangle }\right] \cdots \left[ \exp (- \text{i}\hat{h} t){|{\phi _{\xi _N}(t)}\rangle }\right] \\&= \sum _{\xi _1, \cdots \xi _N} c_{\xi _1, \cdots \xi _N} {|{\phi _{\xi _1}(t)}\rangle } \cdots {|{\phi _{\xi _N}(t)}\rangle } . \end{aligned}$$

Note that the dimension of each \(\exp (- \text{i}\hat{h} t)\) that needs to be compute is M, whereas the naive approach treats the time evolution operator \(\hat{U}(t)\) of size \(M^{N}\). This reduction of the dimensionality dramatically improves speed of the time evolution and makes the multi-photon simulation feasible.

Initial states

All the initial states of the atoms at \(t=0\) are set in their ground states. For example, \(c_{j}(0)=0\) in the case of the single-photon system, and a Gaussian-shaped photon is injected in the space as

$$\begin{aligned} c(0, \textbf{k}) = \frac{2 \sigma \sqrt{\pi }}{L} \exp \left( -\frac{\sigma ^2}{2} (\textbf{k}-\bar{\textbf{k}})^2 -\text{i}\textbf{k}\cdot \bar{\textbf{r}} \right) , \end{aligned}$$
(22)

where \(\sigma \) is a width of the Gaussian. The vectors \(\bar{\textbf{k}}\) and \(\bar{\textbf{r}}\) are parameters to decide the initial velocity and position, respectively. For the simulations with the polarization, the initial state is given by

$$\begin{aligned} c_p(0,\textbf{k}) = (\delta _{p, H} \cos \theta + \delta _{p, V} \sin \theta ) c(0, \textbf{k}), \end{aligned}$$

where \(\theta \) is an initial polarization angle and \(\delta \) is the Kronecker delta.

As in Sections “Hong–Ou–Mandel interference” and “Violation of Bell-CH SH inequality”, the two Gaussian-shaped photons are injected at \(t=0\). The modes of the photons are characterized by \(\xi \) and \(\eta \), where \(\xi \) and \(\eta \) indicate sets of the photon properties that are \(\sigma \), \(\bar{\textbf{k}}\) and \(\bar{\textbf{r}}\). For the HOM interference, we used an initial state as

$$\begin{aligned} {|{\Phi (0)}\rangle }= \frac{1}{\sqrt{2}} {|{\phi _\xi (0)}\rangle }{|{\phi _\eta (0)}\rangle } + (\xi \leftrightarrow \eta ), \end{aligned}$$

where \((\xi \leftrightarrow \eta )\) refers to the exchange of the indices in the previous term, which originates from the commutative relation of bosons. For the test of the Bell-CHSH inequality, the initial state entangles their polarization p.

$$\begin{aligned} {|{\Phi (0)}\rangle }= & {} \frac{1}{\sqrt{4}} \Bigl \{ {|{\phi _{H,\xi } (0)}\rangle } {|{\phi _{H,\eta } (0)}\rangle } + {|{\phi _{V,\xi } (0)}\rangle } {|{\phi _{V,\eta } (0)}\rangle } \Bigr \} \\+ & {} (\xi \leftrightarrow \eta ). \end{aligned}$$

Computational details

Table 1 summarizes the parameters list that are used in the calculation shown in the main text. All the simulations are performed by the time step \(\delta t = 0.1\) and Gaussian width \(\sigma = 2.0\). Because we used the arbitrary unit by using \(\hbar =c=1\), here we evaluate the spatio temporal scale in the real units. To recover the units, at a typical optical wavelength of 500 nm, the system size of the Mach–Zehnder interferometer (see Fig. 1) is \(\sim 0.025\) mm and simulation time \(t = 46\) is corresponding to 0.12 ps. Naively, for the lab scale simulation with a photon at an optical wavelength, we need to set a \(10^5\) times larger space size. To reduce the computational cost, Krylov subspace techniques52,53 and quantics tensor trains54 might be applied.

Table 1 Parameter list of the numerical calculation.