7 Changing the odds: An introduction to Q#


This chapter covers

  • Using the Quantum Development Kit to write quantum programs in Q#
  • Using Jupyter Notebook to work with Q#
  • Running Q# programs using a classical simulator

Up to this point, we’ve used Python to implement our own software stack to simulate quantum programs. If you recall, figure 2.1 (appearing again as figure 7.1), was a good model for how the programs we are writing interact with the quantum simulator and devices that we use and build as quantum developers.

Figure 7.1 A mental model for how we can use a quantum computer. The top half of the figure is the general model for a quantum computer. Given we are using local simulators for this book, the bottom half represents what we are building and using.

Moving forward, we’ll be writing more intricate quantum programs that will benefit from specialized language features that are hard to implement by embedding our software stack in Python. Especially as we explore quantum algorithms, it’s helpful to have a language tailor-made for quantum programming at our disposal. In this chapter, we’ll get started with Q#, Microsoft’s domain-specific language for quantum programming, included with the Quantum Development Kit.

7.1 Introducing the Quantum Development Kit

7.2 Functions and operations in Q#

7.2.1 Playing games with quantum random number generators in Q#

7.3 Passing operations as arguments

7.4 Playing Morgana’s game in Q#