Classiq / classiq-library

The Classiq Library is the largest collection of quantum algorithms, applications. It is the best way to explore quantum computing software. We welcome community contributions to our Library 🙌
https://platform.classiq.io
MIT License
267 stars 94 forks source link

Classiq Basics: Quantum Addition #29

Open amir-naveh opened 2 months ago

amir-naveh commented 2 months ago

In this issue, we will create a simple tutorial of quantum addition using Classiq. This tutorial should follow the structure of the quantum superpostion tutorial:

To complete this issue, follow these steps:

  1. Create a new jupyter notebook (.ipynb file). Use any jupyter editor (e.g. jupyter lab, google colab, etc).
  2. Use Classiq's SDK to create quantum addition: $|a\rangle|b\rangle|0\rangle^{\otimes n} \rightarrow |a\rangle|b\rangle|a+b\rangle $. So, for example, if $a=\frac{1}{\sqrt{2}}(|1\rangle + |3\rangle)$ and $b = |2\rangle$ the final state should be $|\psi\rangle = \frac{1}{\sqrt{2}}(|1\rangle |2\rangle|3\rangle + |3\rangle|2\rangle|5\rangle)$. To do this, you can use the + operator, built in to the QMOD language. Create two registers in an initial state, and add them using the + operator. You can find examples here.
  3. Similar to the superposition notebook, create a short mathematical explanation of the work. Jupyter notebooks support markdown cells, which can contain LaTeX. You can view the source or the superposition notebook to see how this is done. Chat GPT is an excellent LaTeX assistant.
  4. After creating the notebook, make sure you insert the write_qmod(model, "bell_state.qmod") line. Run the notebook, and you will automatically generate the .qmod file for this example.
  5. Make sure the notebook looks well, does not have any typos / mistakes, and is running properly.
  6. Follow the contribution guidelines to open a pull request. Submit the tutorial to the directory: classiq-library/community/basic_examples/quantum_addition

If you have any questions or comments, you can ask them here in the issue, or in our slack community, and the Classiq team will be happy to assist.

Happy quantum coding!

mitul3737 commented 5 days ago

I would like to work on this