Learn Quantum Computing with Python and Q#: A hands-on approach
✍ Scribed by Sarah C. Kaiser, Christopher E. Granade
- Publisher
- Manning Publications
- Year
- 2021
- Tongue
- English
- Leaves
- 385
- Edition
- 1
- Category
- Library
No coin nor oath required. For personal study only.
✦ Synopsis
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 computers present a radical leap in speed and computing power. Improved scientific simulations and new frontiers in cryptography that are impossible with classical computing may soon be in reach. Microsoft’s Quantum Development Kit and the Q# language give you the tools to experiment with quantum computing without knowing advanced math or theoretical physics.
About the book
Learn Quantum Computing with Python and Q# introduces quantum computing from a practical perspective. Use Python to build your own quantum simulator and take advantage of Microsoft’s open source tools to fine-tune quantum algorithms. The authors explain complex math and theory through stories, visuals, and games. You’ll learn to apply quantum to real-world applications, such as sending secret messages and solving chemistry problems.
What's inside
• The underlying mechanics of quantum computers
• Simulating qubits in Python
• Exploring quantum algorithms with Q#
• Applying quantum computing to chemistry, arithmetic, and data
About the reader
For software developers. No prior experience with quantum computing required.
About the author
Dr. Sarah Kaiser works at the Unitary Fund, a non-profit organization supporting the quantum open-source ecosystem, and is an expert in building quantum tech in the lab. Dr. Christopher Granade works in the Quantum Systems group at Microsoft, and is an expert in characterizing quantum devices.
✦ Table of Contents
Learn Quantum Computing with Python and Q#
brief contents
contents
foreword
preface
acknowledgments
about this book
Who should read this book
How this book is organized: A roadmap
About the code
liveBook discussion forum
Other online resources
Going further
about the authors
about the cover illustration
Part 1—Getting started with quantum
1 Introducing quantum computing
1.1 Why does quantum computing matter?
1.2 What is a quantum computer?
1.3 How will we use quantum computers?
1.3.1 What can quantum computers do?
1.3.2 What can’t quantum computers do?
1.4 What is a program?
1.4.1 What is a quantum program?
Summary
2 Qubits: The building blocks
2.1 Why do we need random numbers?
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 Qubits: States and operations
2.3.1 State of the qubit
2.3.2 The game of operations
2.3.3 Measuring qubits
2.3.4 Generalizing measurement: Basis independence
2.3.5 Simulating qubits in code
2.4 Programming a working QRNG
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.4 Using a secret key to send secret messages
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: 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
Summary
5 Nonlocal games: Implementing a multi-qubit simulator
5.1 Quantum objects in QuTiP
5.1.1 Upgrading the simulator
5.1.2 Measuring up: How can we measure multiple qubits?
5.2 CHSH: Quantum strategy
Summary
6 Teleportation and entanglement: Moving quantum data around
6.1 Moving quantum data
6.1.1 Swapping out the simulator
6.1.2 What other two-qubit gates are there?
6.2 All the single (qubit) rotations
6.2.1 Relating rotations to coordinates: The Pauli operations
6.3 Teleportation
Summary
Part 1: Conclusion
Part 2—Programming quantum algorithms in Q#
7 Changing the odds: An introduction to Q#
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#
Summary
8 What is a quantum algorithm?
8.1 Classical and quantum algorithms
8.2 Deutsch–Jozsa algorithm: Moderate improvements for searching
8.2.1 Lady of the (quantum) Lake
8.3 Oracles: Representing classical functions in quantum algorithms
8.3.1 Merlin’s transformations
8.3.2 Generalizing our results
8.4 Simulating the Deutsch–Jozsa algorithm in Q#
8.5 Reflecting on quantum algorithm techniques
8.5.1 Shoes and socks: Applying and undoing quantum operations
8.5.2 Using Hadamard instructions to flip control and target
8.6 Phase kickback: The key to our success
Summary
9 Quantum sensing: It’s not just a phase
9.1 Phase estimation: Using useful properties of qubits for measurement
9.1.1 Part and partial application
9.2 User-defined types
9.3 Run, snake, run: Running Q# from Python
9.4 Eigenstates and local phases
9.5 Controlled application: Turning global phases into local phases
9.5.1 Controlling any operation
9.6 Implementing Lancelot’s best strategy for the phase-estimation game
Summary
Part 2: Conclusion
Part 3—Applied quantum computing
10 Solving chemistry problems with quantum computers
10.1 Real chemistry applications for quantum computing
10.2 Many paths lead to quantum mechanics
10.3 Using Hamiltonians to describe how quantum systems evolve in time
10.4 Rotating around arbitrary axes with Pauli operations
10.5 Making the change we want to see in the system
10.6 Going through (very small) changes
10.7 Putting it all together
Summary
11 Searching with quantum computers
11.1 Searching unstructured data
11.2 Reflecting about states
11.2.1 Reflection about the all-ones state
11.2.2 Reflection about an arbitrary state
11.3 Implementing Grover’s search algorithm
11.4 Resource estimation
Summary
12 Arithmetic with quantum computers
12.1 Factoring quantum computing into security
12.2 Connecting modular math to factoring
12.2.1 Example of factoring with Shor’s algorithm
12.3 Classical algebra and factoring
12.4 Quantum arithmetic
12.4.1 Adding with qubits
12.4.2 Multiplying with qubits in superposition
12.4.3 Modular multiplication in Shor’s algorithm
12.5 Putting it all together
Summary
Wrapping up
Appendix A—Installing required software
A.1 Running samples online
A.1.1 Using Binder
A.1.2 Using GitHub Codespaces
A.2 Installing locally using Anaconda
A.2.1 Installing Anaconda
A.2.2 Installing packages with Anaconda
A.3 Installing the Quantum Development Kit
A.3.1 Installing the .NET Core SDK
A.3.2 Installing the project templates
A.3.3 Installing the Visual Studio Code extension
A.3.4 Installing IQ# for Jupyter Notebook
Appendix B—Glossary and quick reference
B.1 Glossary
B.2 Dirac notation
B.3 Quantum operations
B.4 Q# Language
B.4.1 Types
B.4.2 Q# declarations and statements
B.4.3 Q# expressions and operators
B.4.4 Q# standard libraries
B.4.5 IQ# magic commands
Appendix C—Linear algebra refresher
C.1 Approaching vectors
C.2 Seeing the matrix for ourselves
C.2.1 Party with inner products
Appendix D—Exploring the Deutsch–Jozsa algorithm by example
D.1 Using our skills to try things
D.2 Step 1: Preparing the input state for Deutsch–Jozsa
D.3 Step 2: Applying the oracle
D.3.1 Example 1: The “id” oracle
D.3.2 Example 2: The “not” oracle
D.3.3 Example 3: The “zero” oracle
D.4 Steps 3 and 4: Undo the preparation on the target qubit, and measure
index
Symbols
A
B
C
D
E
F
G
H
I
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
✦ Subjects
Python; Encryption; Quantum Computing; Chemistry; Search Algorithms; Quantum Cryptography; Q#; Quantum Algorithms
📜 SIMILAR VOLUMES
<b><i>Learn Quantum Computing with Python and Q#</i> introduces quantum computing from a practical perspective.</b> <b>Summary</b> <i>Learn Quantum Computing with Python and Q#</i> demystifies quantum computing. Using Python and the new quantum programming language Q#, you’ll build your own qu
<span><p><b>A step-by-step guide to learning the implementation and associated methodologies in quantum computing with the help of the IBM Quantum Experience, Qiskit, and Python that will have you up and running and productive in no time</b></p><h4>Key Features</h4><ul><li>Determine the difference b
Key Features Use Q-learning to train deep learning models using Markov decision processes (MDPs) Study practical deep reinforcement learning using deep Q-networks Explore state-based unsupervised learning for machine learning models Q-learning is a machine learning algorithm used to solve optimizat
<p>Explore the potential of quantum information processing and understand the state of a quantum system with this practical guide</p><p><br></p><p>Key Features: </p><ul><li>Get well-versed with quantum information processing using Python</li><li>Understand the basics of quantum cryptography by imple