Skip to content

A Quantum Algorithm for Solving Linear Differential Equations: Theory and Experiment - Paper Implementation Project #801

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Barath-T opened this issue Feb 27, 2025 · 3 comments · May be fixed by #894
Assignees
Labels
Paper Implementation Project Implement a paper using Classiq

Comments

@Barath-T
Copy link

We (@ManjulaGandhi, @Harimakesh and @Barath-T) aim to implement a quantum algorithm for solving linear differential equations (LDEs) based on A Quantum Algorithm for Solving Linear Differential Equations: Theory and Experiment (arXiv:1807.04553). Specifically, we will construct a quantum circuit that solves the harmonic oscillator equation using the approach outlined in this paper.

We focus on solving the differential equation of harmonic oscillator:

$$y'' + \omega^2 y = 0, \quad y(0) = 1, \quad y'(0) = 1$$

with $$\omega = 1$$.

Technical Approach

This equation can be rewritten as a first-order system:

$$ x(t) = \begin{bmatrix} y \\ y' \end{bmatrix}. $$

$$ \frac{dx}{dt} = \begin{bmatrix} 0 & 1 \\ -\omega^2 & 0 \end{bmatrix} x. $$

For LDE given by:

$$ \frac{dx(t)}{dt} = Mx(t) + b $$

the solution is given by:

$$ x(t) = e^{Mt} x(0) + (e^{Mt} - I) M^{-1} b $$

If the exponential evolution $e^{Mt}$ and the inverse operator $M^{-1}$ can be effectively realized, one can easily obtain the solution $x(t)$.
The $k$-th order approximate solution converts to:

$$ |x(t)⟩ ≈ \sum_{m=0}^{k} \frac{‖x(0)‖ (‖M‖ A t)^m}{m!} |x(0)⟩ + \sum_{n=1}^{k} \frac{‖b‖ (‖M‖ A)^{n-1} t^n}{n!} |b⟩ $$

up to normalization.

The algorithm

  • The quantum system is initialized with work qubits (to store vectors) and two sets of ancilla qubits.
  • The initial vectors |x(0)⟩ and |b⟩ are prepared based on the first ancilla qubit state.
  • A sequence of controlled operations evolve the system while ensuring that necessary transformations on |x(0)⟩ and |b⟩ occur in parallel. This step prepares the system for solving the differential equation.
  • The encoding operations are reversed to extract useful information.
  • Specific unitary transformations ensure that the final system state contains the desired solution components.
  • The final state is measured in a specific subspace where all ancilla qubits are |0⟩.
  • The solution to the LDE, |x(t)⟩, is obtained up to a normalization factor N2.

when A is non-unitary

  • it can be expressed as a linear combination of unitary operators: $A = \sum \alpha_i A_i$
  • This requires an additional ancilla register to label the different $A_i$​'s.
@NadavClassiq
Copy link
Collaborator

Hello @Barath-T!

Great paper choice!

Please note that we accept high-quality implementations to our repository and will be glad to accept a contribution that meets our standards.

Good luck!

@NadavClassiq NadavClassiq added the Paper Implementation Project Implement a paper using Classiq label Feb 27, 2025
Barath-T added a commit to Barath-T/classiq-library that referenced this issue Mar 27, 2025
…lving Linear Differential Equations: Theory and Experiment - Paper Implementation Project
Barath-T added a commit to Barath-T/classiq-library that referenced this issue Mar 31, 2025
Barath-T added a commit to Barath-T/classiq-library that referenced this issue Apr 14, 2025
@TaliCohn
Copy link
Member

Hi @Barath-T, are you still working on this?

@Barath-T
Copy link
Author

@TaliCohn we have resolved PR comments waiting for another review!

Barath-T added a commit to Barath-T/classiq-library that referenced this issue May 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Paper Implementation Project Implement a paper using Classiq
Projects
None yet
3 participants