# Week 1 Exercise and Homework

## Exercises:

1. Follow the Design - The Qmod Language tutorial:

2. Write within the IDE with the native syntax a quantum algorithm that coherently calculates $$y = 2x + 4z + 2$$ where $$x$$ and $$z$$ are quantum numbers represented with 5 qubits each, initialized in a superposition of all possible values.

3. Follow the Design - Quantum Variables and Functions tutorial:

4. Create another quantum function flip_lsb that flips the least significant bit.

5. Follow the Optimize - The Synthesis Engine tutorial:

6. Modify the constraints such that you optimize the circuit for minimal circuit depth using a maximum of 25 qubits. What are the circuit depth and width you receive? Are they different from the given example?

7. Open the example from the Analyze - Classiq Visualization Tool tutorial in the IDE:

8. Export it as a LaTeX file, and view it in a LaTeX Editor (it is recommended to use Overleaf - a free, easy-to-use online LaTeX editor).

10. First, adapt the code such that the quantum number $$x$$ is allocated with 8 qubits. Then, execute the algorithm with 5096 shots and post-process the results from your Python SDK. Plot a graph of all the measured values of $$x$$ and $$y$$ with the corresponding axes (make sure you receive the graph of $$y = x^2 + 1$$).

1. Synthesize 3 different implementations of an MCX (multi-control-X) with 5 control qubits and 1 target qubit:

2. Use the control quantum operation for implementing an MCX, following this tutorial that can be opened in the IDE. One implementation should be optimized for minimized depth, the other for minimized width, and the third somewhere in between (choose yourself what is the maximal width/depth you apply).

3. Export the 3 implementations as LaTeX files on the hierarchy level that demonstrates the differences between the implementations.

4. Aggregate the implementations in 1 file, export it as a PDF, and explain the key differences. (It is recommended to use Overleaf - a free, easy-to-use online LaTeX editor).

5. Synthesize 2 different implementations of an MCX with 20 control qubits and 1 target qubit:

6. Compare the circuit width and circuit depth required for each implementation.