Abstract
Variational quantum algorithms offer a promising new paradigm for solving partial differential equations on nearterm quantum computers. Here, we propose a variational quantum algorithm for solving a general evolution equation through implicit timestepping of the Laplacian operator. The use of encoded source states informed by preceding solution vectors results in faster convergence compared to random reinitialization. Through statevector simulations of the heat equation, we demonstrate how the time complexity of our algorithm scales with the Ansatz volume for gradient estimation and how the timetosolution scales with the diffusion parameter. Our proposed algorithm extends economically to higherorder timestepping schemes, such as the Crank–Nicolson method. We present a semiimplicit scheme for solving systems of evolution equations with nonlinear terms, such as the reaction–diffusion and the incompressible Navier–Stokes equations, and demonstrate its validity by proofofconcept results.
Introduction
Partial differential equations (PDEs) are fundamental to solving important problems in disciplines ranging from heat and mass transfer, fluid dynamics and electromagnetics to quantitative finance and human behavior. Finding new methods to solve PDEs more efficiently—including making use of new algorithms or new types of hardware—has been an active area of research.
Recently, the advent of quantum computers and the invention of new quantum algorithms have provided a novel paradigm for solving PDEs. A cornerstone of many of these quantum algorithms is the seminal HarrowHassidimLloyd (HHL) algorithm^{1} for solving linear systems, which can be utilized to solve PDEs by discretizing the PDE and mapping it to a system of linear equations. Compared to classical algorithms, the HHL algorithm can be shown to exhibit an exponential speedup. Unfortunately, attractive as it may sound, the HHL algorithm works only in an idealized setting, and a list of caveats must be addressed before it can be used to realize a quantum advantage^{2}. Moreover, implementing HHL and many other quantum algorithms would require the use of a faulttolerant quantum computer, which may not be available in the near future^{3}. Instead, the machines we have today are imperfect, noisy intermediatescale quantum (NISQ) devices^{4} with both coherent and incoherent errors limiting practical circuit depths.
Over the last few years, variational quantum algorithms (VQAs) have emerged as a leading strategy to realize a quantum advantage on NISQ devices. Specifically, VQAs employ shallow circuit depths to optimize a cost function, expressed in terms of an Ansatz with tunable parameters, through iterative evaluations of expectation values^{5}. Applications of VQAs include the variational quantum eigensolver (VQE) for finding the ground or excited states of a system Hamiltonian^{6,7,8}, the quantum approximate optimization algorithm (QAOA) for solving combinatorial optimization problems^{9}, and solvers for linear^{10,11,12} and nonlinear^{13} systems of equations.
Here, we are interested in variational quantum algorithms for solving differential equations^{14}, such as the Black–Scholes equation^{15,16}, the Poisson equation^{17,18}, and the Helmholtz equation^{19}. Specifically, the Poisson equation can be solved efficiently through explicit decomposition of the coefficient matrix derived from finite difference discretization^{17} using minimal cost function evaluations^{18} and shallower circuit depth compared to other nonvariational quantum algorithms^{14,20,21,22}. A natural question to ask, then, is whether such variational algorithms for Poisson equations can be extended to solving evolution equations, i.e. partial differential equations including a time domain. McArdle et al.^{23} proposed a variational quantum algorithm which simulates the real (imaginary) time evolution of parametrized trial states via forward Euler timestepping of the Wick rotated Schrödinger equation, thereby solving the Black–Scholes equation, and by extension, the heat equation^{15,16}. Besides issues of Ansatz selection and quantum complexity, timestepping based on an explicit Euler method may be unstable, a limiting condition exacerbated by noise. With existing variational quantum algorithms^{10}, an implicit scheme for evolution equations is expected to preserve any quantum advantage^{1} over classical algorithms, with reduced time complexity^{18}.
This paper is organized as follows. In section “Theory”, we outline general implicit timestepping schemes for solving evolution partial differential equations and propose the use of a variational quantum solver to resolve the Laplacian operator iteratively. In section “Applications to the heat/diffusion equation”, we apply the variational quantum algorithm to solving a heat or diffusion equation without source terms as a proof of concept. With that, we explore potential applications to more general evolution problems with nonlinear source terms, including the reaction–diffusion (section “Applications to the reaction–diffusion equations”) and the Navier–Stokes equations (section “Applications to the Navier–Stokes equations”), where variables can be coupled through semiimplicit schemes.
Theory
Consider the secondorder homogeneous evolution equation defined on the set \(\Omega \times J\), where \(\Omega \subset \mathbb R^d\) denotes a ddimensional bounded spatial domain and \(J = [0,T]\), where \(T>0\) denotes a bounded temporal domain, as
where \(u(\vec{x},t)\) is a function of spatial vector \(\vec{x}\) and time t, \(D>0\) is the diffusion coefficient and f is an unspecified source term. For now, Dirichlet and Neumann boundary conditions are applicable on the boundary \(\Gamma := \partial \Omega = \Gamma _D\cup \Gamma _N\), respectively,
where \(\partial /\partial n\) is the outward normal derivative on boundary \(\Gamma\).
For a twodimensional rectangular domain \(\Omega = (x_L,x_R )\times (y_L,y_R) \subset \mathbb R^2\), partitioning the spacetime domain \(\Omega \times J\) yields the spacetime grid points
where \(n_x\), \(n_y\) and \(n_t\) are prescribed positive integers, such that \(x_i=x_L+i\cdot \Delta x\), \(y_j=y_L+j \cdot \Delta y\), \(t^k=k\cdot \Delta t\), \(\Delta x=L_x/n_x\) , \(\Delta y=L_y/n_y\) and \(\Delta t=T/n_t\) , where \(L_x=x_Rx_L\) and \(L_y=y_Ry_L\). The discrete domain grid is denoted by \(\Omega _d=\{(x_i,y_j ): n_x \in \{0,1,\ldots ,n_x\}, n_y \in \{0,1,\ldots ,n_y\} \}\) and boundary grid by \(\Gamma _d\).
The finite difference (FD) approximation for the secondorder spatial derivative (5point) of the Laplacian operator taken at \(t=t^k\) is
where \(\delta _x :=D \Delta t/\Delta x^{2}\) and \(\delta _y:=D \Delta t/\Delta y^{2}\) are diffusion parameters.
Using firstorder FD for temporal derivative \((u_{ij}^{k+1}u_{ij}^k)/\Delta t\) weighted by \(\vartheta \in [0,1]\), the evolution Eq. (1) can be expressed in vector shorthand as
where \(\mathcal {I}\) is the identity matrix of the same size, \(u^{k}=\left[ u_{i j}^{k}\right] _{0 \le i \le n_{x}, 0 \le j \le n_{y}}\) and \(f^{k}=\left[ f_{i j}^{k}\right] _{0 \le i \le n_{x}, 0 \le j \le n_{y}}\).
Depending on the choice of parameter \(\vartheta\), actual timestepping may follow an explicit (forward Euler) method (\(\vartheta =0\)), an implicit (backward Euler) method (\(\vartheta =1\)), a semiimplicit (Crank–Nicolson) method (\(\vartheta =1/2\)) or a variable\(\vartheta\) method^{24}. The explicit method (\(\vartheta =0\)) is efficient for each timestep but is only stable if it satisfies the stability condition \(v\le 1/2\). The implicit (backward Euler) method (\(\vartheta =1\)) is unconditionally stable and firstorder accurate in time (\(\varepsilon \sim \Delta t\)), which reads
The semiimplicit Crank–Nicolson (CN) method (\(\vartheta =1/2\)) is popular as it is not only stable, but also secondorder accurate in both space and time (\(\varepsilon \sim \Delta t^2\)), which reads
where \(f^{k+1/2}=(f^{k+1}+f^k )/2\). However, the CN method may introduce spurious oscillations to the numerical solution for nonsmooth data unless the algorithm parameters satisfy the maximum principle^{25}.
Variational quantum solver
Here, we explore a variational quantum approach towards the solution of the evolution equation (1). In addition to potential quantum speedup, a variational quantum algorithm could also benefit from data compression, where a matrix of dimension N can be expressed by a quantum system with only \(\log _2 N\) qubits, where N is the size of the problem. Consider the Poisson equation, which is a timeindependent form of Eq. (1), expressed as
The Laplacian operator \(\nabla ^2\) in one dimension can be discretized using the finite difference method in the x direction into an N N coefficient matrix \(A_{x,\beta }\) as
where \(\beta \in \{D,N\}\) refers to either the Dirichlet (D) or Neumann (N) boundary condition, and \(\alpha _D=1\) and \(\alpha _N=0\). This extends naturally to higher dimensions, for instance \(A_{y,\beta }\) in the y direction.
A variational quantum solution is to prepare a state \( u \rangle\) such that \(A  u \rangle\) is proportional to a state \( b \rangle\) in a way that satisfies Eq. (10). To do that, a canonical approach^{10,11,12} is to first decompose the matrix A over the Pauli basis \(\mathcal P_n = \{P_1\otimes \cdots \otimes P_n: \forall i,P_i \in \{I,X,Y,Z\} \}\) (where \(X=1\rangle \!\langle 0 +0\rangle \!\langle 1\), \(Y = i1\rangle \!\langle 0 i 0\rangle \!\langle 1\), and \(Z=0\rangle \!\langle 0 1\rangle \!\langle 1\) are the Pauli matrices and \(I=0\rangle \!\langle 0 +1\rangle \!\langle 1\) is the identity matrix) as
where \(c_P={{\,\mathrm{tr}\,}}(PA)/2^n\) are the coefficients of A in the Pauli basis. Using simple operators \(\sigma _+ = 0\rangle \!\langle 1\), \(\sigma _ = 1\rangle \!\langle 0\), the number of terms in the decomposition can be reduced to \(2 \log N+1\)^{17}. A more efficient approach, however, is to express A as a linear combination of unitary transformations of simple Hamiltonians^{18}. Accordingly, the decomposition of A in one dimension can be written as^{19}
where \(I_0 = 0\rangle \!\langle 0\) and \(\beta \in \{D,N\}\), as before except here, \(a_D=0\) and \(a_N=1\). Here, S is the nqubit cyclic shift operator defined as
The expectation values of a Hamiltonian H including the shift operator S are evaluated by applying the unitary shift operator to the quantum state^{18},
where \( \phi \rangle\) is an arbitrary nqubit state and \( \phi ' \rangle = S  \phi \rangle\). Note that Eq. (13) can be rewritten as
Since expectation values of the identity operator are equal to 1, i.e. \(\langle \phi I^{\otimes n}  \phi \rangle = \langle \phi '  I^{\otimes n}  \phi ' \rangle = 1\), evaluating the expectation value of the operator \(A_{x, \beta }\) requires only the evaluation of expectation values of the simple Hamiltonians \(H_{14}\) (\(H_{13}\) for Dirichlet boundary condition). The required number of quantum circuits is therefore limited to a constant \(O(n^0)\)^{18}. Similar decomposition expressions apply to problems of higher dimensions, including \(A_{y,\beta }\) in the y direction^{19}.
Once the matrix A is decomposed, a parameterized quantum state \( \psi (\theta ) \rangle\) is prepared using an Ansatz represented by a sequence of quantum gates \(U(\theta )\) parameterized by \(\theta\) applied to a basis state \( 0 \rangle ^{\otimes n}\), such that \( \psi (\theta ) \rangle = U(\theta )  0 \rangle ^{\otimes n}\). Here, we use a hardwareefficient Ansatz consisting of multiple layers of \(R_Y\) gates across n qubits entangled by controlledX gates (see Fig. 1). For the source term f in (10), a quantum state \( b \rangle\) is prepared by encoding a real vector with the unitary \(U_b\), such that \( b \rangle = U_b  0 \rangle ^{\otimes n}\). Depending on the actual input, conventional amplitude encoding methods^{26,27} may introduce a global phase that must be corrected by its complex argument for computing in the real space.
With \( \psi (\theta ) \rangle\) and \( b \rangle\), the cost function E can be optimized in terms of A as^{18}
where \( \psi (\theta ),b \rangle := ( 0 \rangle  \psi (\theta ) \rangle +  1 \rangle  b \rangle )/\sqrt{2}\). The norm of the state vector \( \psi (\theta ) \rangle\) is represented by \(r\in \mathbb R\), where
The quantum circuit required for the numerators of (17) and (18) consists of an encoding unitary \(U_b\) and a parameterized Ansatz \(U(\theta )\) (Fig. 1), both oppositely controlled by an ancilla qubit placed in superposition^{17}. As for the denominators, the number of quantum circuits required corresponds to the number of decomposed terms of the Hamiltonian (13), each paired with the Ansatz \(U(\theta )\). Finally, the resulting states of these circuits are measured in the computational basis.
Using classical optimization tools, the cost function (17) is minimized with \(\theta\) updated iteratively until convergence is reached. The optimization process follows either a gradientbased or gradientfree approach, depending on how the gradient of the cost function is evaluated. A gradientfree optimizer is guided by an estimate of the inverse Hessian matrix, whereas a gradientbased optimizer by the partial derivative of the cost function E with respect to parameters \(\theta\), i.e. \(\partial E /\partial \theta\), which can be evaluated by a quantum computer (for details, see^{18,19}). Regardless of the choice of gradient optimizer used, the optimization routine halts when the cost error falls under a convergence threshold (\(\epsilon < \epsilon _{\mathrm {tol}}\)) whence the parameters are at optimum \(\theta =\theta _\mathrm {opt}\). The converged solution vector \( u \rangle = r_{\mathrm {opt}}  \psi (\theta _{\mathrm {opt}} \rangle\) satisfies^{10}
where \(r_{\mathrm {opt}}=r(\theta _{\mathrm {opt}} )\) is the norm of the solution to the Poisson equation (10).
In this study, we propose to solve the evolution equation (1) through successive timestepping of the quasisteady Poisson equation using a variational quantum algorithm. Using a parameter set \(\theta ^k\) obtained at timestep k, we encode a normalized source state \( \hat{b}^k \rangle :=  b \rangle /\sqrt{\langle bb\rangle }\) from \( b(\theta ^k) \rangle\) and seek an implicit solution to
where \(\theta ^{k+1}=\theta _\mathrm {opt}(t^{k+1} )\) is the parameter set and \(r^{k+1}=r_\mathrm {opt}(\theta ^{k+1})\) is the norm at next timestep \(k+1\). This process is then iterated in time up to \(n_t\) number of timesteps as desired (see Algorithm 1).
The cost function \(E(\theta ^k)\) may be evaluated on a quantum computer by computing each of the inner products in the expression in Eq. (17) separately. Using the decomposition provided in Eq. (16), these inner products may be expressed in terms of expectation values \(\langle \varphi  O_i  \varphi \rangle\) for preparable states \( \varphi \rangle\) and simple Hermitian operators \(O_i\). Each expectation value \(\langle \varphi  O_i  \varphi \rangle\) is evaluated on a quantum computer by preparing the state \( \varphi \rangle\) using the quantum circuits described above and then measuring the operator \(O_i\) in the state \( \varphi \rangle\)^{18}.
In this study, the variational quantum algorithm is implemented in Pennylane (Xanadu)^{28} using a statevector simulator with the Qulacs^{29} plugin as a backend for quantum simulations, and the LBFGSB optimizer for parametric updates. Amplitude encoding is carried out via the standard Mortonnen state preparation template^{30} with custom global phase correction. For hardware emulation via the QASM simulator (Qiskit), we refer the reader to the excellent costsampling analysis of Sato et al. ^{18}.
Applications to the heat/diffusion equation
Consider the following onedimensional heat or diffusion equation without a source term
Dirichlet conditions are applied on the boundaries of a 1D domain \(\Omega =(x_L,x_R)\subset \mathbb R\), where \(u(x_L,t)=g_L (t)\) and \(u(x_R,t)=g_R (t)\), such that the boundary vector \(u_D=(g_L, 0,\ldots , 0,g_R )\) is known for all t.
To solve Eq. (22), the variational quantum evolution algorithm (Algorithm 1) can be employed with a suitable timestepping scheme (7). For the implicit Euler (IE) method (8), the matrix A and source state \( b(\theta ^k) \rangle\) can be decomposed into
where \( u^k \rangle = r^k \psi \left( \theta ^{k}\right) \rangle\).
For the CrankNicolson (CN) method (9), it follows that the \(\mathcal Au^k\) term, which carries a small but nontrivial evaluation cost, can be eliminated using the source state of the previous timestep \(k1\), leading to
where \(2\left \bar{u}_{D}^{k+1/2}\right\rangle :=\left( \left u_{D}^{k+1}\right\rangle +\left u_{D}^{k}\right\rangle \right)\). Here, the presence of a \(k1\) term in \(\left b^{k1}\right\rangle\) is not unexpected due to temporal finite differencing at secondorder accuracy.
For a spacetime domain \(\Omega \times J\in [0,1] \times [0,1]\), let the number of timesteps be \(n_t=20\) and the spatial intervals be \(n_x=2^n+1\), where n is the number of qubits, and \(\delta _x=1\) is the diffusion parameter. We employ the Dirichlet boundary condition with boundary values \((g_L,g_R )=(1,0)\) and initial values \(u_0= \mathbf {0}\). With initial random parameters \(\theta ^0 \in [0,2 \pi ]\), we run a limitedmemory BroydenFletcherGoldfarbShanno boxed (LBFGSB) optimizer^{31,32,33,34} to optimize \(\theta\) with absolute and gradient tolerances set at \(10^{8}\).
Figure 2a compares solutions obtained from the variational quantum solver (23) and classical methods to a 1D heat or diffusion problem in timeincrements of 0.1, where the number of qubits and Ansatz layers expressed as a set n l, are 3 3 and 4 4. Here we define the timeaveraged trace error \(\bar{\epsilon }_{\mathrm {tr}}\) as
where \(\left \hat{u}^{k}\right\rangle :=\left u^{k}\right\rangle / \sqrt{\left\langle u^{k} \mid u^{k}\right\rangle }\) is the normalized classical solution vector at time k. The trace errors of solutions shown in Fig. 2a are 0.0008 and 0.0025 for n l sets of 33 and 44 respectively.
Figure 2b shows how the cost function E depends on the number of optimization steps for nl of 33 and 44 (10 sampled runs each). Each distinct step in E represents sequential optimization from solution \( \psi (\theta ^k) \rangle\) at timestep k towards the solution \( \psi (\theta ^{k+1}) \rangle\) at \(k+1\). For small timestep \(\Delta t\), \(\theta ^k\) provides a good initial parameter set for solving optimization step \(k+1\). If the Ansatz parameters were reinitialized randomly \(\theta ^k\in [0,2\pi ]\) before each timestep, significantly more optimization steps would be required on average for convergence for each run (see Fig. 2b, inset).
Time complexity
Here we briefly examine the time complexity of the quantum algorithm excluding the classical computing components. Following the analysis of the variational Poisson solver^{18}, the time complexity of the proposed variational evolution equation solver per timestep reads
where the terms within the inner parentheses indicate the time complexity of the state preparation scaling as \(\mathcal {O}(l+e+n^2 )\), which consists of the Ansatz depth l, the encoding depth \(e = \mathcal {O}(n^2)\)^{35}, the depth of the circuit needed to implement the nqubit cyclic shift operator \(O(n^2)\), and that of the number of shots \(\mathcal {O}(\varepsilon ^{2})\) required for estimation of expectation values up to a mean squared error of \(\varepsilon ^2\). The required number of quantum circuits depends on the boundary conditions applied (3 for periodic, 4 for Dirichlet and 5 for Neumann conditions), scaling only as \(\mathcal {O}(n^0 )\). \(\bar{T}_{\mathrm {eval}}\) is the timeaveraged number of function evaluations,
where \(T_{\mathrm {eval}}\) is the sum of function evaluations required for a run with \(n_t\) timesteps. Using a gradientbased optimizer, the time complexity for gradient estimation via quantum computing would scale as the Ansatz volume \(\mathcal {O}(nl)\) representing the number of quantum circuits required for parameter shifting. Otherwise, with a gradientfree optimizer, the time complexity simply contributes towards \(\bar{T}_{\mathrm {eval}}\) as additional function evaluations required to evaluate the Hessian for gradient descent.
To see if the time complexity for gradientfree optimization scales as \(\mathcal {O}(nl)\), we plot the timeaveraged number of function evaluations \(\bar{T}_{\mathrm {eval}}\) against the number of parameters nl (Fig. 3a). Indeed, we found that \(\bar{T}_{\mathrm {eval}}\) scales reasonably with nl (see trendline of slope 1), despite apparent tapering at higher l. Figure 3b shows that the timeaveraged trace error \(\bar{\varepsilon }_{{{\,\mathrm{tr}\,}}}\) decreases with circuit depth l, even for overparameterized quantum circuits where the number of layers exceeds the minimum required for convergence, \(l_{\mathrm {min}} := 2^n/n\)^{36}. For low grid resolution \(n = 3\), the trace error is limited to a minimum of \(\sim 10^{4}.\) Since the time complexity for solving the Poisson equation classically is \(\mathcal {O}(N\log _2N)\), where \(N=2^n\), quantum advantage could be realized with the proposed algorithm with linear time scaling by \(n_t\) at subexponential time complexity^{18}.
For deep and wide quantum circuits, the increase in optimization time is exacerbated by the presence of barren plateaus, or vanishingly small gradients in the energy landscape, where reinitialization can leave one trapped at a position far removed from the minimum^{37,38,39}. Conversely, short timesteps lead to efficient solution trajectories that remain close to the local cost minima, leading to significant reduction in optimization times. To verify this, we conduct numerical simulations varying the diffusion parameter \(\delta\) with \(l=n\) up to time \(T=1\). Figure 3c shows that the number of iterations, or required optimization steps, per timestep increases linearly with \(\delta\). Close inspection of the timeaveraged trace distance shows bimodal distributions at higher \(\delta\), which separates success and failure during convergence towards the global minimum (see Fig. 3d, dotted lines), resembling local minima traps due to poor optimization or expressivity of Ansätze^{19,40}.
Discretization error
Time evolution can be at a higher order, specifically for the CrankNicolson method. The problem statement is identical to the previous one, except with Dirichlet boundary values \((g_L, g_R) = (0,0)\) and the initial condition \(u_0 = \sin (\pi x/L_x\)), where we use \(L_x=1\) as the spatial length of the domain. This admits an exact analytical solution,
Figure 4 compares variational quantum and exact solutions using implicit Euler and CrankNicolson (CN) schemes. The discretization error for the higherorder CN scheme is reduced significantly, especially at lower grid resolution (\(n=3\)). Although the complexity costs for both methods (23) and (24) are similar, note however that the CN method may introduce spurious oscillations for nonsmooth data^{24}, an issue which may be exacerbated by quantum noise^{41}.
Higher dimensions
The preceding analysis can be extended to higher dimensions. Consider the following twodimensional heat or diffusion equation in \(\Omega \times J\), where \(\Omega =(x_L,x_R )\times (y_L,y_R) \subset \mathbb R^2\):
Under the implicit Euler scheme (8), the matrix A and source state \( b^k \rangle\) can be decomposed into
Dirichlet conditions are applied on the boundaries, where \(u(x_{L,R},y,t) = g_{x_{L,R}}(y,t)\) and \(u(x,y_{L,R},t) = g_{y_{L,R}}(x,t)\). Let the number of spatial grid intervals be \(n_x = 2^{m_x} + 1\) and \(n_y = 2^{m_y} + 1\), where \(m_x\) is the number of qubits allocated to the x grid, \(m_y\) to the y grid, and \(n=m_x+m_y\) is the total number of qubits. Accordingly, A is decomposed in terms of simple Hamiltonians in x and y as
where \(H_{14}\) are simple Hamiltonians to be evaluated (\(H_{13}\) for Dirichlet boundary condition).
Figure 5 shows solution snapshots to a 2D heat conduction or diffusion problem taken at time \(T = 1\) with Dirichlet boundary values \((g_{x_L},g_{x_R}) = (0,0)\) and \((g_{y_L},g_{y_R})=(1,0)\), initial values \(u_0=\mathbf {0}\), \(n_t = 20\) and diffusion parameters \(\delta _x=\delta _y=1\). Results obtained from variational quantum solver agree with classical solutions with timeaveraged trace errors of up to \(10^{2}\).
Applications to the reaction–diffusion equations
Here, we extend applications of our variational quantum solver to evolution equations with nontrivial source terms. Consider a twocomponent homogeneous reactiondiffusion system of equations
where \(\mathbf {u}=[u_1,u_2]^T\) is a concentration tensor, \(\mathbf {D}={\text {diag}}[D_1,D_2]^T\) is a diffusion tensor and \(\mathbf {f} = [f_1(u_1,u_2), f_2(u_1,u_2)]^T\) is a coupled reaction source term. First proposed by Turing^{42}, the reactiondiffusion equations are useful for understanding pattern formation and selforganization in biological and chemical systems^{43,44}, such as morphogenesis^{45} and autocatalysis^{46}.
Here, we propose a semiimplicit timestepping scheme, whereby the coupled, nonlinear source term is solved at the current timestep k. With explicit source term \(f^k\), the implicit Euler scheme (8) reads
The twocomponent tensor \(\mathbf {A}=[A_1,A_2]^T\) and source state \(\mathbf {b}=[b_1,b_2]^T\) can then be decomposed into
where \(\mathbf {\delta _x} = 2^{2n}\Delta t\mathbf {D}\) is the twocomponent diffusion parameter vector. With a linear Hermitian source matrix f, a fully implicit timestepping scheme becomes available (Appendix A).
Implementation
The semiimplicit variational quantum solver solves for the Laplacian for each component using a quantum computer and the solution vectors are explicitly coupled through source terms prior to reencoding in preparation for the next timestep (see Algorithm 2).
1D Gray–Scott model
The GrayScott model^{46} was originally conceived to model chemical reactions of the type \(U + 2V \rightarrow 3V\), \(V \rightarrow P\), where U, V and P are chemical species with reaction term
where \(k_1\) and \(k_2\) are kinetic rate constants.
An interesting class of GrayScott solutions involves periodic splitting of chemical wave pulses^{24,47}. Here, we conduct a pulse splitting numerical experiment under limited spatial and temporal resolutions, using input parameters \(\mathbf {D}=[10^{4},10^{6}]^T\), \(k_1 = 0.04\) and \(k_2 = 0.02\), with a midpulse initial condition and Dirichlet boundary conditions as
where time t extends up to \(T=600\) on \(dt = 0.5\).
Figure 6a shows how an initial midpulse can spontaneously and periodically split in space and time, a phenomenon captured using variational quantum diffusion reaction solver (see Algorithm 2) even on relatively low spatial resolutions.
1D Brusselator model
So far, we have been looking at only Dirichlet boundary conditions. Here, we demonstrate a test example for Neumann boundary conditions in a diffusionreaction model, namely, the Brusselator model^{48}, which was developed by the Brussels school of Prigogine to model the behavior of nonlinear oscillators in a chemical reaction system. The model reaction term reads
Using \(\mathbf {D}=[10^{4},10^{4}]^T\), \(k_1 = 3\) and \(k_2 = 1\), with initial conditions
where time t extends up to \(T=400\) on \(dt = 0.5\).
Figure 6b shows how a chemical pulse can be spontaneously created, which continually travels leftwards in time, creating traveling waves that appear as striped patterns in time despite low spatial resolutions.
Applications to the Navier–Stokes equations
The NavierStokes equations are a set of nonlinear partial differential equations that describes the motion of fluids across continuum length scales. There are several studies aimed at applying quantum algorithms to computational fluid dynamics (see review^{49}), ranging from reduction of partial differential equations to ordinary differential equations^{50} and quantum solutions of substeps of the classical algorithm^{51,52} to the quantum Lattice Boltzmann scheme^{53}.
Here, we look into the potential use of variational quantum algorithms to evolve the fluid momentum equations in time. Consider the incompressible NavierStokes equations in nondimensional form
where \(\mathbf {u}\) is the velocity vector and p is the fluid pressure. The ratio \(\mathrm {Re}=U_cL_c/\nu\) is the Reynolds number, where \(U_c\) is the characteristic flow velocity across a characteristic lengthscale \(L_c\) and \(\nu\) is the fluid kinematic viscosity.
Unlike other temporal evolution equations, the incompressible NavierStokes equations cannot be timemarched directly as the resultant velocities do not satisfy the continuity constraint (45), and hence are not divergencefree. To resolve this, the projection method^{54}, also known as the predictorcorrector or fractional step method, separates the solution timestep into velocity and pressure substeps, also known as the predictor and corrector steps.
Projection method
Predictor step
The predictor step first approximates an intermediate velocity \(\mathbf {u^{*}}\) by solving the fluid momentum equation (44) in the absence of pressure, i.e. the Burgers’ equations^{55}, of the form
Through a semiimplicit scheme, the viscous terms are handled implicitly using the variational quantum evolution equation solver and the nonlinear inertial terms explicitly as source terms using classical computation. For quantum algorithms for nonlinear problems, the reader is referred to separate works on quantum ordinary differential equation solvers^{50,55}, Carleman linearization^{56} and a variational quantum nonlinear processing unit (QNPU)^{13}.
On a twodimensional domain with Dirichlet boundary conditions, the tensor \(\mathbf {A_u}=[A_u,A_v]^T\) and source state \(\mathbf {b_u}=[b_u,b_v]^T\) can be decomposed as
where \(\delta _x := \Delta t/(\mathrm {Re}\Delta x^{2})\) and \(\delta _y:= \Delta t/(\mathrm {Re}\Delta y^{2})\). \(F^k = D^k_u B_{x,D} + D^k_v B_{y,D}\) is an operator which approximates the nonlinear inertial term, where \(\mathbf {D^k_{u}}\) are diagonal matrices with velocity vectors \(\mathbf { u^k \rangle }\) along the diagonals and B is a divergence matrix discretized through center differencing, for instance in the x direction, as
where \(\beta \in \{D,N\}\) refers to either Dirichlet (D) or Neumann (N) boundary condition. Here, \(\alpha _D=0\) and \(\alpha _N=1\).
Corrector step
The second corrector step solves for the velocity \(\mathbf {u^{k+1}}\) by correcting the intermediate velocities \(\mathbf {u^*}\) using the pressure gradient as a Lagrange multiplier to enforce continuity. Applying divergence to the correction equations yields the pressure Poisson equation for the pressure field at halfstep
which can be solved implicitly in two dimensions (x, y) via the following decomposition:
Note the addition of a simple Hermitian \(I_0 = 0\rangle \!\langle 0\) to the pressure matrix \(A_p\), which would otherwise be singular (corank 1) under Neumann boundary conditions for the pressure field.
With the new pressure \(p^{k+1}\), the velocities are updated at the \(k+1\) timestep as
where \(\mathbf {B_N} = [B_{x,N}, B_{y,N}]^T\) are the gradient operators.
Implementation
Overall, the variational quantum solver for NavierStokes equations using the projection method (see Algorithm 3) involves two sequential steps, the first requiring a number of Algorithm 1 iterations equal to the number of velocity components, and the second for the pressure Poisson step. For twodimensional flows, the number of velocity components to be solved can be effectively reduced by one through the vorticity streamfunction formulation (Appendix B). In computational fluid dynamics, these implicit systems of linear equations are often the most computationally expensive parts to solve in classical algorithms, providing incentives for potential speedup via quantum computing^{49,52}.
2D cavity flow
The liddriven cavity flow is a standard benchmark for testing incompressible Navier–Stokes equations^{57}. Consider a twodimensional square domain \(\Omega =(0,L)\times (0, L) \subset \mathbb R^2\) with only one wall sliding tangentially at a constant velocity. For simplicity, we employ a fixed collocated grid, instead of a staggered grid which helps avoid spurious pressure oscillations but at the cost of increased mesh and discretization complexity. Noslip boundary conditions apply on all walls, so that zero velocity applies on all wall boundaries except one moving at \(u(x,0)=1\).
Figure 7a shows a snapshot of a test case conducted on a \(2^n=8\times 8\) grid at \(\Delta t=0.5\) up to \(T = 5\), with the central vortex shown by normalized velocity quivers in white. In terms of time complexity, we note that the pressure correction step requires a greater number of function evaluations for convergence compared to an implicit velocity step (Fig. 7b). This is due to the additional quantum circuits for evaluating the \(H_4\) Hamiltonians (32, 33) for Neumann boundary conditions and one for specifying the reference pressure (50), leading to a total of 9 evaluation terms compared to 6, a ratio which corroborates with the apparent \(\sim 50\%\) increase in function evaluations shown in Fig. 7b.
While not directly comparable to classical computational fluid dynamics in numerical accuracy, this exercise, nevertheless, roadmaps potential applications of the variational quantum method towards more complicated flow problems^{52}.
Conclusion
In this study, we proposed a variational quantum solver for evolution equations which include a Laplacian operator to be solved implicitly. For short timesteps \(\Delta t\), the use of initial parameter sets encoded from prior solution vectors results in faster convergence compared to random reinitialization. The overall time complexity scales with the Ansatz volume \(\mathcal {O}(nl)\) for gradient estimation and with the number of timesteps \(\mathcal {O}(n_t)\) for temporal discretization. Our proposed algorithm extends naturally to higherorder timestepping and higher dimensions. For evolution equations with nontrivial source terms, the semiimplicit scheme can be applied, where nonlinear source terms are handled explicitly. Using statevector simulations, we demonstrated that variational quantum algorithms can be useful in solving popular partial differential equations, including the reactiondiffusion and the incompressible NavierStokes equations. Together, our proposed algorithm extends the use of quantum Poisson solvers to solve timedependent problems with reduced time complexity from variational quantum algorithms over classical computation.
The present work aims at bridging the gap between variational quantum algorithms and practical applications. Our work has assumed that the state preparations, unitary transformations and measurements are implemented perfectly, and does not consider the effects of quantum noise from actual hardware or any potential amplification from iterative timestepping. In our implementation, we only considered the hardwareefficient Ansatz with \(R_y\) rotation gates and controlledNOT entanglers, and thus leave open the question about the performance of other Ansätze. Future work can include noise mitigation^{58,59,60}, quantum random access memory^{61,62,63}, tensor networks^{64}, Ansatz architecture, nonlinear algorithms and costefficient encoding.
Data availability
The datasets used and/or analysed during the current study are available from the corresponding author on reasonable request.
References
Harrow, A. W., Hassidim, A. & Lloyd, S. Quantum algorithm for linear systems of equations. Phys. Rev. Lett. 103, 150502 (2009).
Aaronson, S. Read the fine print. Nat. Phys. 11(4), 291–293 (2015).
Bharti, K. et al. Noisy intermediatescale quantum algorithms.. Rev. Mod. Phys. 94, 015004 (2022).
Preskill, J. Quantum computing in the NISQ era and beyond. Quantum 2, 79 (2018).
Cerezo, M. et al. Variational quantum algorithms. Nat. Rev. Phys. 3, 625–644 (2021).
Peruzzo, A. et al. A variational eigenvalue solver on a photonic quantum processor. Nat. Commun. 5(1), 1–7 (2014).
McClean, J. R., Romero, J., Babbush, R. & AspuruGuzik, A. The theory of variational hybrid quantumclassical algorithms. New J. Phys. 18(2), 023023 (2016).
Kandala, A. et al. Hardwareefficient variational quantum eigensolver for small molecules and quantum magnets.. Nature 549(7671), 242–246 (2017).
Edward, F., Jeffrey, G. & Sam, G.. A quantum approximate optimization algorithm. arXiv:1411.4028 (2014).
BravoPrieto, C., LaRose, R., Cerezo, M., Subasi, Y., Cincio, L., & Coles, P. J. Variational quantum linear solver. arXiv:1909.05820 (2019).
Huang, H.Y., Bharti, K. & Rebentrost, P. Nearterm quantum algorithms for linear systems of equations with regression loss functions. New J. Phys. 23(11), 113021 (2021).
Xu, X. et al. Variational algorithms for linear algebra. Sci. Bull. 66(21), 2181–2188 (2021).
Lubasch, M., Joo, J., Moinier, P., Kiffner, M. & Jaksch, D. Variational quantum algorithms for nonlinear problems. Phys. Rev. A 101(1), 010301 (2020).
Arrazola, J. M., Kalajdzievski, T., Weedbrook, C. & Lloyd, S. Quantum algorithm for nonhomogeneous linear partial differential equations. Phys. Rev. A 100(3), 9 (2019).
Fontanela, F., Jacquier, A. & Oumgari, M. A quantum algorithm for linear PDEs arising in finance. SIAM J. Financ. Math. 12(4), SC98–SC114 (2021).
Miyamoto, K. & Kubo, K. Pricing multiasset derivatives by finitedifference method on a quantum computer. IEEE Trans. Quantum Eng. 3, 1–25 (2021).
Liu, H.L. et al. Variational quantum algorithm for the Poisson equation. Phys. Rev. A 104(2), 022418 (2021).
Sato, Y., Kondo, R., Koide, S., Takamatsu, H. & Imoto, N. Variational quantum algorithm based on the minimum potential energy for solving the Poisson equation. Phys. Rev. A 104(5), 052409 (2021).
Ewe, W.B., Koh, D. E., Goh, S. T., Chu, H.S. & Png, C. E. Variational quantumbased simulation of waveguide modes. IEEE Trans. Microw. Theory Tech. 70(5), 2517–2525 (2022).
Cao, Y., Papageorgiou, A., Petras, I., Traub, J. & Kais, S. Quantum algorithm and circuit design solving the Poisson equation. New J. Phys. 15(1), 013021 (2013).
Linden, N., Montanaro, A. & Shao, C. Quantum vs. classical algorithms for solving the heat equation. arXiv:2004.06516 (2020).
Childs, A. M., Liu, J.P. & Ostrander, A. Highprecision quantum algorithms for partial differential equations. Quantum 5, 574 (2021).
McArdle, S. et al. Variational ansatzbased quantum simulation of imaginary time evolution.. NPJ Quantum Inform. 5(1), 1–6 (2019).
Lee, P. & Kim, S. A variable\(\theta\) method for parabolic problems of nonsmooth data. Comput. Math. Appl. 79(4), 962–981 (2020).
Crank, J. & Nicolson, P. A practical method for numerical evaluation of solutions of partial differential equations of the heatconduction type. Math. Proc. Camb. Philos. Soc. 43(1), 50–67 (1947).
Möttönen, M., Vartiainen, J. J., Bergholm, V. & Salomaa, M. M. Transformation of quantum states using uniformly controlled rotations.. Quantum Inf. Comput. 5(6), 467–473 (2005).
Shende, V. V., Bullock, S. S. & Markov, I. L. Synthesis of quantumlogic circuits. IEEE Trans. Comput. Aided Des. Integr. Circuits Syst. 25(6), 1000–1010 (2006).
Bergholm, V., Izaac, J., Schuld, M., Gogolin, C., Sohaib Alam, M., Ahmed, S., Miguel Arrazola, J., Blank, C., Delgado, A., Jahangiri, S., et al. Pennylane: Automatic differentiation of hybrid quantumclassical computations. arXiv:1811.04968 (2018).
Suzuki, Y. et al. Qulacs: A fast and versatile quantum circuit simulator for research purpose. Quantum 5, 559 (2021).
Schuld, Maria & Petruccione, Francesco. Supervised Learning with Quantum Computers (Quantum Science and Technology, Springer, 2019).
Shanno, D. F. Conditioning of quasiNewton methods for function minimization. Math. Comput. 24(111), 647–656 (1970).
Goldfarb, D. A family of variablemetric methods derived by variational means. Math. Comput. 24(109), 23–26 (1970).
Fletcher, R. A new approach to variable metric algorithms. Comput. J. 13(3), 317–322 (1970).
Broyden, C. G. The convergence of a class of doublerank minimization algorithms 1. General considerations. IMA J. Appl. Math. 6(1), 76–90 (1970).
Israel F. Araujo, Daniel K. Park, Francesco Petruccione, and Adenilton J. da Silva. A divideandconquer algorithm for quantum state preparation. Sci. Rep. 2021 11:1, 11:1–12 (2021).
Patil, H., Wang, Y. & Krstić, P. S. Variational quantum linear solver with a dynamic ansatz. Phys. Rev. A 105(1), 012423 (2022).
Huembeli, P. & Dauphin, A. Characterizing the loss landscape of variational quantum circuits. Quantum Sci. Technol. 6(2), 025011 (2021).
McClean, J. R., Boixo, S., Smelyanskiy, V. N., Babbush, R. & Neven, H. Barren plateaus in quantum neural network training landscapes. Nat. Commun. 9(1), 4812 (2018).
Cerezo, M., Sone, A., Volkoff, T., Cincio, L. & Coles, P. J. Cost function dependent barren plateaus in shallow parametrized quantum circuits. Nat. Commun. 12(1), 1–12 (2021).
Wierichs, D., Gogolin, C. & Kastoryano, M. Avoiding local minima in variational quantum eigensolvers with the natural gradient optimizer. Phys. Rev. Res. 2(4), 043246 (2020).
Cincio, L., Rudinger, K., Sarovar, M. & Coles, P. J. Machine learning of noiseresilient quantum circuits. PRX Quantum 2, 010324 (2021).
Turing, A. M. The chemical basis of morphogenesis. 1953. Bull. Math. Biol., 52(12):153–97; discussion 119–52 (1990).
Van Gorder, R. A. Pattern formation from spatially heterogeneous reaction–diffusion systems. Philos. Trans. R. Soc. A: Math. Phys. Eng. Sci., 379(2213) (2021).
Kondo, S. & Miura, T. Reaction–diffusion model as a framework for understanding biological pattern formation. Science 329(5999), 1616–1620 (2010).
Gierer, A. & Meinhardt, H. A theory of biological pattern formation. Kybernetik 12(1), 30–39 (1972).
Gray, P. & Scott, S. K. Autocatalytic reactions in the isothermal, continuous stirred tank reactor. Chem. Eng. Sci. 38(1), 29–43 (1983).
Zegeling, P. A. & Kok, H. P. Adaptive moving mesh computations for reactiondiffusion systems. J. Comput. Appl. Math. 168(1–2), 519–528 (2004).
Jiwari, R., Singh, S. & Kumar, A. Numerical simulation to capture the pattern formation of coupled reactiondiffusion models. Chaos Solitons Fractals 103, 422–439 (2017).
Griffin, K. P., Jain, S. S., Flint, T. J. & WHR Chan. Investigations of quantum algorithms for direct numerical simulation of the NavierStokes equations. Center for Turbulence Research Annual Research Briefs, pages 347–363 (2019).
Gaitan, F. Finding flows of a Navier–Stokes fluid through quantum computing. NPJ Quantum Inform. 6(1), 61 (2020).
Steijl, R. Quantum algorithms for nonlinear equations in fluid mechanics. In Quantum Computing and Communications, chapter 2 (ed. Zhao, Y.) (IntechOpen, Rijeka, 2022).
Steijl, R. & Barakos, G. N. Parallel evaluation of quantum algorithms for computational fluid dynamics. Comput. Fluids 173, 22–28 (2018).
Budinski, L. Quantum algorithm for the advectiondiffusion equation simulated with the lattice Boltzmann method. Quantum Inf. Process. 20(2), 57 (2021).
Chorin, A. J. Numerical solution of the Navier–Stokes equations. Math. Comput. 22(104), 745–762 (1968).
Oz, F., Vuppala, R. K. S. S., Kara, K. & Gaitan, F. Solving Burgers’ equation with quantum computing. Quantum Inf. Process. 21(1), 30 (2022).
Liu, J. P., Kolden, H., Krovi, H. K., Loureiro, N. F., Trivisa, K. & Childs, A. M. Efficient quantum algorithm for dissipative nonlinear differential equations. Proceedings of the National Academy of Sciences of the United States of America, 118(35), (2021).
Erturk, E., Corke, T. C. & Gökçöl, C. Numerical solutions of 2D steady incompressible driven cavity flow at high Reynolds numbers. Int. J. Numer. Meth. Fluids 48(7), 747–774 (2005).
Li, Y. & Benjamin, S. C. Efficient variational quantum simulator incorporating active error minimization. Phys. Rev. X 7, 021050 (2017).
Temme, K., Bravyi, S. & Gambetta, J. M. Error mitigation for shortdepth quantum circuits. Phys. Rev. Lett. 119, 180509 (2017).
Endo, S., Benjamin, S. C. & Li, Y. Practical quantum error mitigation for nearfuture applications. Phys. Rev. X 8, 031027 (2018).
Chen, Z.Y. et al. Quantum approach to accelerate finite volume method on steady computational fluid dynamics problems. Quantum Inf. Process. 21(4), 1–27 (2022).
Giovannetti, V., Lloyd, S. & Maccone, L. Architectures for a quantum random access memory. Phys. Rev. A 78(5), 052310 (2008).
Giovannetti, V., Lloyd, S. & Maccone, L. Quantum random access memory. Phys. Rev. Lett. 100(16), 160501 (2008).
Gourianov, N. et al. A quantuminspired approach to exploit turbulence structures. Nature Comput. Sci. 2(1), 30–37 (2022).
Acknowledgements
We thank Maria Schuld for helpful comments on amplitude embedding. This work was supported in part by the Agency for Science, Technology and Research (#21709) under Grant No. C210917001. DEK acknowledges funding support from the National Research Foundation, Singapore, through Grant NRF2021QEP202P03.
Author information
Authors and Affiliations
Contributions
F.Y.L. designed the study. W.B.E. and D.E.K. advised the study. F.Y.L. and W.B.E. wrote the software code. F.Y.L. ran simulations and analyzed data. All authors wrote and reviewed the manuscript.
Corresponding author
Ethics declarations
Competing interests
The authors declare no competing interests.
Additional information
Publisher's note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Appendices
A Fully implicit scheme for linear Hermitian source term
For a reactiondiffusion system of equations with nontrivial source terms (35), timestepping could be rendered fully implicit if the source terms can be expressed as a linear Hermitian matrix with constant coefficients. Consider a twocomponent 1D chemical reaction with source terms of the form
where \(k_{ij}\) (\(i,j \in \{1,2\}\)) are kinetic rate constants that are components of the linear Hermitian matrix \(K = K^T \in \mathbb R^{N\times N}\), whose offdiagonal elements are equal, i.e. \(k_{12}=k_{21}\); \(\mathcal {I}\) is the identity matrix of size \(N\times N\) and \([u_1, u_2]^T\) is a concentration vector of length 2N. This problem requires \(n+1\) qubits, where \(n=\log _2N\). Following the implicit Euler scheme (Eq. 8), we set up a \(2N\times 2N\) coefficient matrix, which decomposes as
where \(A_{x,\beta }\) is the discretized \(N \times N\) coefficient matrix for a single component (Eq. 16) containing up to four Hamiltonian terms \(H_{14}\). Note the last three additional Hamiltonian terms contributed by the source term.
B Vorticity streamfunction formulation
For twodimensional incompressible flows, the vorticity streamfunction formulation can be used to eliminate the pressure as a dependent variable, such that
where \(\omega = \partial v/\partial x  \partial u/\partial y\) is the flow vorticity and the streamfunction \(\psi\) satisfies \(u=\partial \psi /\partial y\) and \(v=\partial \psi /\partial x\). It follows that the reformulation \(\{u,v,p\} \rightarrow \{\omega ,\psi \}\) can simplify the variational quantum algorithm 3 by reducing the number of velocity components by one, at the cost of specifying streamfunction values along the domain boundaries.
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.
About this article
Cite this article
Leong, F.Y., Ewe, WB. & Koh, D.E. Variational quantum evolution equation solver. Sci Rep 12, 10817 (2022). https://doi.org/10.1038/s41598022149063
Received:
Accepted:
Published:
DOI: https://doi.org/10.1038/s41598022149063
This article is cited by

An efficient quantum partial differential equation solver with chebyshev points
Scientific Reports (2023)

Extracting a function encoded in amplitudes of a quantum state by tensor network and orthogonal function expansion
Quantum Information Processing (2023)

NISQ computing: where are we and where do we go?
AAPPS Bulletin (2022)
Comments
By submitting a comment you agree to abide by our Terms and Community Guidelines. If you find something abusive or that does not comply with our terms or guidelines please flag it as inappropriate.