Learn Quantum Computing with Python and Q#
A hands-on approach
Sarah C. Kaiser and Christopher E. Granade
  • MEAP began April 2019
  • Publication in Fall 2020 (estimated)
  • ISBN 9781617296130
  • 300 pages (estimated)
  • printed in black & white

A great introduction to the exciting new world of quantum computing.

William Wheeler
Learn Quantum Computing with Python and Q# demystifies quantum computing. Using Python and the new quantum programming language Q#, you’ll build your own quantum simulator and apply quantum programming techniques to real-world examples including cryptography and chemical analysis.

About the Technology

Quantum computing is the next step in computing power and scalability, with the potential to impact everything from data science to information security. Using qubits, the fundamental unit of quantum information, quantum computers can solve problems beyond the scale of classical computing. Software packages like Microsoft's Quantum Development Kit and the Q# language are now emerging to give programmers a quick path to exploring quantum development for the first time.

About the book

Learn Quantum Computing with Python and Q# demystifies quantum computing. Using Microsoft’s Quantum Development Kit to abstract away the mathematical complexities, this book builds your understanding of quantum computers by actively developing for them. You’ll start by learning QC fundamentals by creating your own quantum simulator in Python. Soon you’ll move on to using the QDK and the new Q# language for writing and running algorithms very different to those found in classical computing. When you’re finished you’ll be able to apply quantum programming techniques to applications like quantum key distribution, and tackle real-world examples such as chemistry simulations and searching unsorted databases.
Table of Contents detailed table of contents

Part 1: Getting Started with Quantum

1 Introducing Quantum Computing

1.1 Who This Book is For

1.2 Who This Book is Not For

1.2.1 Textbooks and other resources for learning further

1.3 How this book is organized

1.4 Why does quantum computing matter?

1.4.1 Decisions that are strongly impacted by quantum computing

1.5 What Can Quantum Computers Do?

1.5.1 Some useful quantum algorithms

1.6 What is a Quantum Computer?

1.6.1 How will we use quantum computers?

1.6.2 What can’t quantum computers do?

1.7 What is a Program?

1.7.1 What is a Quantum Program?

1.8 Summary

2 Qubits: The Building Blocks

2.1 Why do we need random numbers?

2.1.1 Things some humans like to use randomness for

2.1.2 Statements about probability

2.1.3 Quantum random number generator algorithm

2.2 What are Classical Bits?

2.2.1 What Can We Do With Classical Bits?

2.2.2 Abstractions are our friend

2.3 Approaching Vectors

2.3.1 Examples of vectors

2.4 Seeing the Matrix for Ourselves

2.4.1 Examples of linear functions

2.4.2 Party with inner products

2.5 Qubits: States and Operations

2.5.1 State of the qubit

2.5.2 The game of Operations

2.5.3 Measuring Qubits

2.5.4 Generalizing measurement: basis independence

2.5.5 Simulating qubits in code

2.6 Programming a Working QRNG

2.6.1 QRNG

2.6.2 Quantum device interface requirements.

2.6.3 Qubit interface requirements

2.7 Summary

3 Sharing Secrets with Quantum Key Distribution

3.1 All’s Fair in Love and Encryption

3.1.1 Quantum NOT operations

3.1.2 Sharing classical bits with qubits

3.2 A tale of two bases

3.3 Quantum Key Distribution: BB84

3.3.1 Steps of the BB84 protocol:

3.4 Using our secret key to send secret messages

3.5 Summary

4 Nonlocal Games: Working with multiple qubits

4.1 Nonlocal Games

4.1.1 What are nonlocal games?

4.1.2 Testing quantum physics itself: The CHSH game

4.1.3 Classical strategy

4.2 Working with multiple qubit states

4.2.1 Registers

4.2.2 Why is it hard to simulate quantum computers?

4.2.3 Tensor products for state preparation

4.2.4 Tensor products for qubit operations on registers

4.3 QuTiP of the Iceberg

4.3.1 Quantum objects in QuTiP

4.3.2 Upgrading the simulator

4.3.3 Measuring up: How can we measure multiple qubits?

4.4 CHSH: Quantum strategy

4.5 Summary

5 Teleportation and entanglement: Moving quantum data around

5.1 Moving quantum data

5.1.1 Swapping out our simulator

5.1.2 What other two-qubit gates are there?

5.2 All the single (qubit) rotations

5.2.1 Relating rotations to coordinates: The Pauli operations

5.3 Teleportation

5.4 Part I: Conclusion

Part 2: Programming Quantum Algorithms In Q#

6 Changing the odds: An introduction to Q#

6.1 Introducing the Quantum Development Kit

6.2 Functions and Operations in Q#

6.3 Passing Operations as Arguments

6.4 Playing Morgana’s Game in Q#

6.5 Summary

7 What is a Quantum Algorithm?

7.1 Classical and quantum algorithms

7.1.1 Quicksort algorithm

7.2 Deutsch—​Jozsa Algorithm: moderate improvements for searching

7.2.1 Lady of the (Quantum) Lake

7.2.2 Oracles: representing classical functions in quantum algorithms

7.3 Simulating the Deutsch—​Jozsa algorithm in Q#

7.4 Exploring the Deutsch—​Jozsa Algorithm by example

7.4.1 Step 1. Preparing the input state for Deutsch—​Jozsa

7.4.2 Step 2. Applying the oracle

7.4.3 Steps 3 and 4. Undo the preparation on the target qubit and measure.

7.5 Reflecting back

7.5.1 Shoes and socks: applying and undoing quantum operations

7.5.2 Using Hadamard instructions to flip control and target

7.5.3 Phase Kickback

7.6 Summary

8 Quantum sensing: It’s not just a phase

8.1 Phase estimation: leveraging useful properties of qubits for measurement

8.1.1 Part and Partial Application

8.2 User-Defined Types

8.3 Run, snake, run: Running Q# from Python

8.4 Eigenstates and Local Phases

8.5 Controlled application: Turning global phases into local phases

8.5.1 Controlling any operation

8.6 Implementing Lancelot’s best strategy for the phase estimation game

8.7 Summary

Part 3: Applied Quantum Computing

9 Solving Chemistry Problems with Quantum Computers

9.1 Real chemistry applications for quantum computing

9.2 Many paths lead to Quantum Mechanics

9.3 Hamiltonians describe how quantum systems evolve in time.

9.4 Rotating around arbitrary axes with Pauli operations

9.5 Making the change you want to see in the system

9.6 Going through (very small) changes

9.7 Putting it all together

9.8 Summary

10 Searching with Quantum Computers

10.1 Searching Unstructured Data

10.2 Reflecting about States

10.2.1 Reflection about the all-ones state

10.2.2 Reflection about an arbitrary state

10.4 Resource Estimation

10.5 Summary

11 Arithmetic With Quantum Computers


Appendix A: Installing Required Software

A.1 Installing a Python Environment

A.1.1 Installing Anaconda

A.1.2 Installing Python packages with Anaconda: QuTiP

A.2 Installing the Quantum Development Kit

A.2.1 Installing the .NET Core SDK

A.2.2 Installing the Project Templates

A.2.3 Installing the Visual Studio Code extension

A.2.4 Installing IQ# for Jupyter Notebook

A.2.5 Installing the qsharp Python package

What's inside

  • The underlying mechanics of how quantum computers work
  • How to simulate qubits in Python
  • Q# and the Microsoft Quantum Developer Kit
  • How to apply quantum algorithms to real-world examples

About the reader

No academic experience of quantum computing is required. A reader will need basic programming skills and some experience of linear algebra, calculus and complex numbers.

About the authors

Christopher Granade completed his PhD in physics (quantum information) at the University of Waterloo’s Institute for Quantum Computing, and now works in the Quantum Architectures and Computation (QuArC) group at Microsoft. He works in developing the standard libraries for Q# and is an expert in the statistical characterization of quantum devices from classical data. Previously, Christopher helped Scott Aaronson prepare lectures into his recent book, Quantum Computing Since Democritus.

Sarah Kaiser completed her PhD in physics (quantum information) at the University of Waterloo’s Institute for Quantum Computing. She has spent much of her career developing new quantum hardware in the lab, from satellites to hacking quantum cryptography hardware. Communicating what is so exciting about quantum is her passion, and she loves finding new demos and tools to help enable the quantum community to grow. When not at the keyboard, she loves kayaking and writing books about engineering for kids.

placing your order...

Don't refresh or navigate away from the page.
Manning Early Access Program (MEAP) Read chapters as they are written, get the finished eBook as soon as it’s ready, and receive the pBook long before it's in bookstores.
print book $24.99 $49.99 pBook + eBook + liveBook
Additional shipping charges may apply
Learn Quantum Computing with Python and Q# (print book) added to cart
continue shopping
go to cart

eBook $19.99 $39.99 3 formats + liveBook
Learn Quantum Computing with Python and Q# (eBook) added to cart
continue shopping
go to cart

Prices displayed in rupees will be charged in USD when you check out.

FREE domestic shipping on three or more pBooks