Skip to main contentIBM Quantum Documentation Preview
This is a preview build of IBM Quantum® documentation. Refer to quantum.cloud.ibm.com/docs for the official documentation.

QUICK-PDE by ColibriTD

See the API reference

Note

IBM Quantum® Functions are a beta feature available only to IBM Quantum Premium Plan, Flex Plan, and On-Prem (through the IBM Quantum Platform API) Plan users. Beta features are subject to change.


Overview

The Partial Differential Equation (PDE) solver presented here is part of our Quantum Innovative Computing Kit (QUICK) platform (QUICK-PDE), and is packaged as a quantum function. With the QUICK-PDE function, you can solve domain-specific partial differential equations on IBM Quantum QPUs. This function is based on the algorithm described in ColibriTD's H-DES description paper. This algorithm can solve complex multi-physics problems, starting with Computational Fluid Dynamics (CFD) and Materials Deformation (MD), and now including quantitative finance with the Black-Scholes equation for options on one to three assets. Other use cases are coming soon.

To tackle the differential equations, the trial solutions are encoded as linear combinations of orthogonal functions (typically Chebyshev polynomials, and more specifically up to 2n2^n of them where nn is the number of qubits encoding your function), parametrized by the angles of a Variable Quantum Circuit (VQC). The ansatz generates a state encoding the function, which is evaluated by observables whose combinations allow for evaluating the function at all points. You can then evaluate the loss function in which the differential equations are encoded, and fine-tune the angles in a hybrid loop, as shown in the following. The trial solutions get gradually closer to the actual solutions until you reach a satisfactory result.

Workflow of the QUICK-PDE function

In addition to this hybrid loop, you can also chain together different optimizers. This is useful when you want a global optimizer to find a good set of angles, and then a more fine-tuned optimizer to follow a gradient to the best set of neighboring angles. In the case of computational fluid dynamics (CFD), the default optimization sequence produces the best results - but in the case of material deformation (MD), while the default provides good results, you can configure it further for problem-specific benefits.

Note that for each variable of the function, you specify the number of qubits (which you can experiment with). By stacking 10 identical circuits and evaluating the 10 identical observables on different qubits throughout one big circuit, you can noise-mitigate within the CMA optimization process or parallelize the PSR computations, relying on the noise learner method, and significantly reducing the number of shots needed.

Computational fluid dynamics

The inviscid Burgers' equation models flowing non-viscous fluids as follows:

∂u∂t+u∂u∂x=0\frac{\partial u}{\partial t} + u\frac{\partial u}{\partial x} = 0,

uu represents the fluid speed field. This use-case has a temporal boundary condition: you can select the initial condition and then allow the system to relax. Currently, the only accepted initial conditions are linear functions: ax+bax + b. The analytical solution is:

u(t,x)=ax+bat+1u(t, x) = \frac{ax + b}{at + 1}.

The pressureless Euler equations model compressible inviscid fluid flow with damping as follows:

∂g∂t+u∂g∂x+g∂u∂x=0\frac{\partial g}{\partial t} + u\frac{\partial g}{\partial x} + g\frac{\partial u}{\partial x} = 0,

u∂g∂t+g∂u∂t+u2∂g∂x+2gu∂u∂x+μ(1+t)λgu=0u\frac{\partial g}{\partial t} + g\frac{\partial u}{\partial t} + u^2\frac{\partial g}{\partial x} + 2gu\frac{\partial u}{\partial x} + \frac{\mu}{(1+t)^{\lambda}} g u = 0,

gg represents the density field, uu the velocity field and μ\mu a damping coefficient. In our formulation, we pose λ=1\lambda = 1, so it will not be used as a parameter in the following. This use-case has temporal boundary conditions: g(0,x)=e−xg(0, x) = e^{-x} and u(0,x)=xu(0, x) = x. The analytical solution is:

g(t,x)=1−μ(1+t)1−μ−μexp⁡ ⁣((μ−1) x(1+t)1−μ−μ)g(t, x) = \frac{1-\mu}{(1+t)^{1-\mu} - \mu} \exp\!\left(\frac{(\mu-1)\, x}{(1+t)^{1-\mu} - \mu}\right),

u(t,x)=(1−μ) x((1+t)1−μ−μ)(1+t)μu(t, x) = \frac{(1-\mu)\, x}{\left((1+t)^{1-\mu} - \mu\right)(1+t)^{\mu}}.

The arguments for CFD's differential equations are on a fixed grid, as follows:

  • tt is between 0 and 0.95 with 41 sample points. xx is between 0 and 0.95 with 41 sample points.

Material deformation

This use case focuses on hypoelastic deformation with the one-dimensional tensile test, in which a bar fixed in space is pulled at its other extremity. We describe the problem as follows:

u′−σ3K−23ϵ0(σ′σ03)n=0u' - \frac{\sigma}{3K} - \frac{2}{\sqrt{3}}\epsilon_0\left(\frac{\sigma'}{\sigma_0\sqrt{3}}\right)^n = 0,

σ′−b=0\sigma' - b = 0,

KK represents the bulk modulus of the material being stretched, nn the exponent of a power law, bb the force per unit mass, ϵ0\epsilon_0 the proportional stress limit, σ0\sigma_0 the proportional strain limit, uu the stress function, and σ\sigma the strain function. The analytical solution is:

σ(x)=σ0−bx\sigma(x) = \sigma_0 - bx,

u(x)=−3−(3+n)/22bK(1+n) σ0n[3(1+n)/2b2σ0n(1+n)x2−2⋅3(1+n)/2bσ0n(1+n)σ0x−12ϵ0Kσ01+nu(x) = -\frac{3^{-(3+n)/2}}{2bK(1+n)\,\sigma_0^{n}}\Biggl[3^{(1+n)/2}b^2\sigma_0^n(1+n)x^2 - 2\cdot 3^{(1+n)/2}b\sigma_0^n(1+n)\sigma_0 x - 12\epsilon_0 K\sigma_0^{1+n} −12bϵ0Kσ0nx(−bx+σ0σ0)n+12ϵ0Kσ0n+1(−bx+σ0σ0)n−12ϵ0Kσ01+n]- 12b\epsilon_0 K\sigma_0^n x\left(\frac{-bx+\sigma_0}{\sigma_0}\right)^n + 12\epsilon_0 K\sigma_0^{n+1}\left(\frac{-bx+\sigma_0}{\sigma_0}\right)^n - 12\epsilon_0 K \sigma_0^{1+n}\Biggr],

where σ0=g(0)\sigma_0 = g(0) is the boundary condition on the strain at x=0x=0.

The considered bar is of unitary length. This use-case has a boundary condition for surface stress tt, or the amount of work needed to stretch the bar.

The arguments for MD's differential equations are on a fixed grid, as follows:

  • xx is between 0 and 1 with 30 sample points.

Quantitative finance

The Black-Scholes equation gives the price CC of a European call option as a function of the time tt and of the price of the underlying asset or assets. We pose a zero interest rate, no dividends and a maturity T=1T = 1. This use case is available for one, two and three assets.

For a single asset, the equation reads:

∂C∂t+σ22S2∂2C∂S2=0\frac{\partial C}{\partial t} + \frac{\sigma^2}{2} S^2 \frac{\partial^2 C}{\partial S^2} = 0,

where σ\sigma is the volatility of the asset and SS its price. The boundary conditions are given by the analytical solution. It fixes the price at the final time t=0.9t = 0.9 (a residual maturity of 0.1) and at the edges S=1S = 1 and S=2S = 2 of the price domain, and the solver recovers the price at the earlier times. The analytical solution is:

C(t,S)=S Φ(d1)−K Φ(d2),d1,2=ln⁡(S/K)±σ22(T−t)σT−tC(t, S) = S\,\Phi(d_1) - K\,\Phi(d_2), \qquad d_{1,2} = \frac{\ln(S/K) \pm \frac{\sigma^2}{2}(T-t)}{\sigma\sqrt{T-t}},

where KK is the strike of the option and Φ\Phi is the cumulative distribution function of the standard normal distribution.

For baskets of two and three assets, the option is written on the geometric average G=∏i=1nSiwiG = \prod_{i=1}^{n} S_i^{w_i} of the nn asset prices, where the weights wiw_i are strictly positive and sum to 1:

∂C∂t+∑i=1nσi22Si2∂2C∂Si2+∑i<jρij σiσj SiSj∂2C∂Si∂Sj=0\frac{\partial C}{\partial t} + \sum_{i=1}^{n} \frac{\sigma_i^2}{2} S_i^2 \frac{\partial^2 C}{\partial S_i^2} + \sum_{i<j} \rho_{ij}\,\sigma_i\sigma_j\, S_i S_j \frac{\partial^2 C}{\partial S_i \partial S_j} = 0,

where σi\sigma_i is the volatility of asset ii and ρij\rho_{ij} the correlation between assets ii and jj. The boundary conditions are given by the analytical solution on the final time and on the edges of the price domain. With τ=T−t\tau = T - t, the analytical solution is:

C=G e−qτ Φ(d1)−K Φ(d2),d1=ln⁡(G/K)+(σG22−q)τσGτ,d2=d1−σGτC = G\,e^{-q\tau}\,\Phi(d_1) - K\,\Phi(d_2), \qquad d_1 = \frac{\ln(G/K) + \left(\frac{\sigma_G^2}{2} - q\right)\tau}{\sigma_G\sqrt{\tau}}, \qquad d_2 = d_1 - \sigma_G\sqrt{\tau},

σG2=∑iwi2σi2+2∑i<jρij wiwj σiσj,q=12(∑iwiσi2−σG2)\sigma_G^2 = \sum_{i} w_i^2\sigma_i^2 + 2\sum_{i<j} \rho_{ij}\, w_i w_j\, \sigma_i\sigma_j, \qquad q = \frac{1}{2}\left(\sum_i w_i\sigma_i^2 - \sigma_G^2\right),

and the one-asset solution is recovered for n=1n = 1 and w1=1w_1 = 1.

The physical parameters of the use case are the following:

Parameter
Description
Range
Business range
sigma, sigma1, sigma2, sigma3Volatility of each asset0.05 to 10.10 to 0.40
KStrike of the option1 to 21.2 to 1.8 (80% to 120% of a spot price at the center of the domain, S=1.5S = 1.5)
w1 (basket of 2 assets)Weight of the first asset. The weight of the second asset is deduced: w2=1−w1w_2 = 1 - w_1Each weight is strictly positive (so 0<w1<10 < w_1 < 1)Each weight from 0.2 to 0.8
w1, w2 (basket of 3 assets)Weights of the first and of the second asset. The weight of the third asset is deduced: w3=1−w1−w2w_3 = 1 - w_1 - w_2Each weight is strictly positive (so w1+w2<1w_1 + w_2 < 1)Each of the three weights from 0.2 to 0.8
rho, rho12, rho13, rho23Correlation between two assets0 to 1 (the correlation matrix must be positive semi-definite)0.1 to 0.8

The range column gives the values accepted by the use case. The business range gives the values commonly met in practice: volatilities of equity indices, large capitalizations and currencies, strikes close to the spot price, moderate to high correlations between assets, and a residual maturity T−tT - t between 0.3 and 1 year.

The arguments for the Black-Scholes differential equations are on a fixed domain, as follows:

  • tt is between 0 and 0.9. The variable xix_i of each asset is between 0 and 1, and the price of the asset is Si=1+xiS_i = 1 + x_i, so between 1 and 2.

Ansatz

The variable quantum circuit that encodes each function is selected with the ansatz argument:

  • HEA is a hardware-efficient ansatz measured with a global observable. It is the most general choice.
  • BPM-LE (Barren Plateau Mitigation, Low Expressivity) is an ansatz designed to avoid barren plateaus, measured with local observables. It has few parameters and shallow circuits, which keeps the cost of the optimization low, including the cost of parameter-shift gradients.
  • BPM-HE (Barren Plateau Mitigation, High Expressivity) follows the same construction with more parameters per circuit, for functions that the low-expressivity version cannot represent accurately enough.

The number of qubits per variable and the depth of the circuit remain controlled by the nb_qubits and depth arguments.

Optimizer chain and error metric

The optimizers are chained as a list of stages with the optimizers argument. Each stage defines its own method, its maximum number of iterations and its own number of shots, so that cheap and noisy evaluations explore the landscape first, and the number of shots increases as the optimization converges. A typical chain is made of the following pieces:

  1. One or more CMAES stages (global and gradient-free), which identify the right region of the space of solutions. Each stage has its own shots, sigma0, and popsize (population size, that is the number of candidates evaluated at each generation). The sigma0 argument is the initial standard deviation of the search distribution of CMA-ES, that is, its initial step size: a large value widely explores the space of the circuit parameters, while a small value searches locally around the best candidate found so far. Decreasing sigma0 from one stage to the next therefore moves from exploration to refinement.
  2. A LS-TRF stage (Least Squares - Trust Region Reflective), which explores this region to refine the final angles. Without psr, LS-TRF estimates the Jacobian of the cost function with finite differences. With psr=True, the Jacobian is computed on the QPU exactly, with the parameter-shift rule (PSR). The PSR increases the computation time since it requires additional circuits, but it allows a better precision than the finite differences.

The error metric used on this page is the Root Mean Square Error (RMSE) between the solution and the reference solution, over the sampled points. The function also reports the mean squared error (MSE) and the maximum absolute deviation, which are the d2 and d1 metrics of Section 2.6 of the H-DES paper.


Benchmarks

The following tables present statistics on various runs of the function. The first table gives the results of the current version of the function. The second table, at the end of this section, only keeps the results of the previous version for reference.

Current version

Example
Total number of qubits
Ansatz
RMSE
Classical compute time (min)
QPU time (min)
Inviscid Burgers' equation4BPM-LE0.0147~111
Pressureless Euler's equations8HEA0.0193~1.510
Hypoelastic 1D tensile test6HEA0.0296~110
Black-Scholes equation, 1 asset6BPM-LE0.0084~0.35.0
Black-Scholes equation, basket of 2 assets7BPM-HE0.0085~412.0
Black-Scholes equation, basket of 3 assets9BPM-HE0.0104~6720.7

The RMSE is the Root Mean Square Error between the solution and the reference solution (aggregated over the two functions for the Euler, and tensile test cases). For the Burgers, Euler, and tensile test cases, it is measured on the QPU over the sampled points. For the Black-Scholes cases, it is computed inside the domain, excluding the final time and the edges where the solution is imposed, on a fine grid (600 points per axis for 1 asset, 80 for 2 assets, 16 for 3 assets), by noiseless simulation at the parameters retained on the QPU. The classical compute time is the time spent by the optimizers on the classical side of the hybrid loop. It is mostly due to the evaluation of the points on the grid, which is easily parallelizable. The QPU time is the quantum processing time billed for the optimization jobs.

The number of qubits is lower than in the previous version. The circuit binding feature reduces the QPU time of the runs, not the number of qubits. It remains possible to increase the number of qubits by executing several circuits in parallel, which reduces the QPU time needed even further, and the new version of the function leaves room to scale to larger numbers of qubits and larger problems.

The optimization steps of these runs are described as follows:

  • The popsize argument is the number of candidates evaluated at each generation of CMAES.
  • The CMAES stages can stop early when the cost stagnates.
  • A cost evaluation is the computation of the cost function for one set of circuit parameters, measured on the QPU with the number of shots of the stage.
  • A CMAES generation is made of popsize evaluations, so the iterations of CMAES are counted in generations.
  • An LS-TRF iteration computes the Jacobian of the cost function at the current point, with the parameter-shift rule (PSR) here, and evaluates the cost function at one or several trial points.
  • The Jacobian requires its own circuits (the parameter-shifted circuits), which are not counted as evaluations. The number of Jacobians is therefore the number of LS-TRF iterations, and the number of evaluations is higher than the number of iterations because some trial points are rejected.
Example
Stage
Method
Shots
sigma0
popsize
Iterations
Inviscid Burgers' equation1CMAES3,0000.41240 generations
2CMAES15,0000.11215 generations
3CMAES50,0000.04126 generations
Pressureless Euler's equations1CMAES2,5000.51212 generations
2CMAES4,0000.151218 generations
3LS-TRF with psr=True10,000n/an/a30 evaluations, 7 iterations (7 Jacobians)
Hypoelastic 1D tensile test1CMAES2,5000.51212 generations
2CMAES4,0000.151218 generations
3CMAES6,0000.071212 generations
4LS-TRF with psr=True10,000n/an/a31 evaluations, 3 iterations (3 Jacobians)

Previous version

Results of the previous version

The values in the following table were obtained with the previous version of the function and its previous parameters. They are kept for reference only and are not the current results.

Example (previous version)
Total number of qubits
Error (RMSE, order of magnitude)
Classical time (min)
QPU time (min)
Inviscid Burgers' equation (previous version)5010−210^{-2}~41~25
Pressureless Euler's equations (previous version)7010−210^{-2}~14~34
Hypoelastic 1D tensile test (previous version)1810−210^{-2}~23~100

The classical time is the part of the duration of the runs that is not spent on the QPU, which includes the calls to the API. The QPU time is the quantum processing time billed for the optimization jobs.


Get support

For support, contact qiskit-function-support@colibritd.com.


Next steps

Recommendations

© IBM Corp., 2017-2026