Learn Quantum Computing with Python and Q#
bookSarah Kaiser, Christopher Granade, Learn Quantum Computing with Python and Q#, 2021, Manning
Concepts
Qubits
Quantum analogue to the classical bits
Quantum Random Number Generation
QRNG
Randomness is important, expecially where security is concerned.
We need RNG that our adversary can’t predict.
While RSA relies on just the assumption that factoring large numbers is hard the randomness of quantum mechanics is guaranteed by physics.
Generating truly random numbers allows the implementation of a secure One-time Pad.
The algorithm:
- allocate a qubit
- apply the Hadamardinstruction to thequbit
- measure the qubit
Quantum Key Distribution
Nonlocal Games
Teleportation & Entanglement
Programming
Setting Up the Environment
The authors use Anaconda w/ Python 3 and the Conda package manager for the qsharp packages.
On Arch the anaconda package on the AUR installs everything but you need to add it to PATH:
PATH=/opt/anaconda/bin:$PATH
Then you set the environment via environment.yml in the book’s repo.
$ conda env create environment.yml
$ conda activate qsharp-book
- for this condaneeds to be set up on the console (bash,zsh, …)
After this the last thing to setup is dotnet, download the appropriate Core SDK.
Install project templates:
$ dotnet new -i "Microsoft.Quantum.ProjectTemplates"
and to use them:
$ dotnet new console -lang Q# -O MyProject
Then to have language hinting on VS Code you need to install the extension Microsoft Quantum Development Kit
- not available on the FOSS version of VS Codeon theAUR
For Jupyter Notebooks you can install IQ#
$ dotnet tool install -g Microsoft.Quantum.IQSharp
$ dotnet iqsharp install