2
$\begingroup$

What are my options for computing symbolic results for quantum circuits?

I have identified some possibilities:

  • SymPy (Python library, see also this), unfortunately, the software forces you to encode the matrix of each gate explicitly instead of working with circuits;

  • IBM Qiskit v0.25 operator framework (Python library), which claims

    Qiskit operators fully support parameterization

    even if it seems not completely true since the same error of this older question holds and this issue is still open.

$\endgroup$
4
  • 3
    $\begingroup$ In Qiskit we mean that you can create circuits and observables with free parameters, however they must be bound to concrete values before simulation. The reason mainly being that symbolic simulation is extremely slow and probably not feasible for anything with more than 4 or 5 qubits. $\endgroup$
    – Cryoris
    Apr 9 at 11:24
  • $\begingroup$ @Cryoris thank you for your answer :) do you think, since the issue is not closed yet, that there is the possibility for this feature to be implemented (even for small circuits)? $\endgroup$
    – incud
    Apr 9 at 12:35
  • $\begingroup$ "unfortunately, the software forces you to encode the matrix of each gate explicitly instead of working with circuits" --- what exactly did you have in mind? You don't want to code the gates X,Y,Z,H,CNOT explicitly in SymPy? $\endgroup$ Apr 11 at 18:28
  • $\begingroup$ @user1271772 thank you for your answer. I wanted to highlight the fact that Sympy (as far as I know) does not have the concept of the quantum circuit, you have to manually define in terms of multiplications, tensor products ecc. the unitary matrix associated with the circuit you have - while (for example) IBM Qiskit operators have this feature built-in. However, since the question is generic, any software for symbolic computation having dedicated features/facilities for quantum computing is accepted. $\endgroup$
    – incud
    Apr 11 at 19:57
2
+50
$\begingroup$

No symbolic computation software with quantum circuits built in

The asker has clarified in this comment that they want a symbolic computation software in which the user does not "have to manually define circuits in terms of matrix multiplications", and the question says that the software cannot "force you to encode the matrix of each gate explicitly". This unfortunately does not exist.

In all symbolic computation software, one will have to encode the matrix of each gate (X,Y,Z,CNOT,H,etc.) and use tensor products (i.e. Kronecker products) and matrix multiplications to get the effect of the unitary operation of a quantum circuit; or find some add-on where someone else did exactly that and made it available to others. Luckily, it is not hard to define the gates manually, and to do matrix multiplications, in any symbolic computation software.

Quantum add-ons for popular symbolic computation software

The most popular long-standing symbolic computation packages which are still actively being developed are:

  • Mathematica,
  • Sage,
  • SymPy,
  • Maple,
  • MATLAB's Symbolic Computation Toolbox,
  • Maxima,
  • Magma, and
  • Scilab

There's others too, which people are welcome to suggest I add, but seriously anything other than the first five are not really "popular" in the circles that I know.

Since none of the above symbolic computation software has quantum circuit functionality built in to the extent where the user does not have to define the gates or explicitly involve matrix multiplications commands *natively *without relying on a third-party add-on where someone else did exactly the same thing, the asker says again in the same comment as above:

"any software for symbolic computation having dedicated features/facilities for quantum computing is accepted."

I will therefore point out that of that list of 8 major symbolic computation software packages, the one with the largest volume of quantum add-ons is Mathematica (also by far the most popular and highly developed package out of all of the above, for symbolic computation):

Quantum add-ons for Mathematica

Therefore "Quantum Mathematica" and "QDENSITY" are your best options with Mathematica, and unfortunately these will require a Mathematica license, which will be very expensive if you don't have a discount or free access through (for example) a university.

Quantum add-ons for Maple

Although Maple has declined in popularity in recent years, they also do support Dirac notation as seen here and here, but there's nothing that can do entire quantum circuits as far as I know.

My recommendation if you don't have access to Mathematica:

Just use SymPy or Sage (both open-source and Python based) and define the gates (X,Y,Z,CNOT,H,etc.) manually and do the matrix multiplications, since this will just take a couple hours. You can also read the above papers on how it was done in Mathematica, to give you ideas on how to efficiently save time in doing it with SymPy or Sage (i.e. how to make it so that you don't have to repeat the identity matrix so many times, for example).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.