0%

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.

Table of Contents

  1. inside front cover
  2. Learn Quantum Computing with Python and Q#
  3. Copyright
  4. dedication
  5. contents
  6. front matter
    1. foreword
    2. preface
    3. acknowledgments
    4. about this book
    5. Who should read this book
    6. How this book is organized: A roadmap
    7. About the code
    8. liveBook discussion forum
    9. Other online resources
    10. Going further
    11. about the authors
    12. about the cover illustration
  7. Part 1. Getting started with quantum
  8. 1 Introducing quantum computing
    1. 1.1 Why does quantum computing matter?
    2. 1.2 What is a quantum computer?
    3. 1.3 How will we use quantum computers?
    4. 1.3.1 What can quantum computers do?
    5. 1.3.2 What can’t quantum computers do?
    6. 1.4 What is a program?
    7. 1.4.1 What is a quantum program?
    8. Summary
  9. 2 Qubits: The building blocks
    1. 2.1 Why do we need random numbers?
    2. 2.2 What are classical bits?
    3. 2.2.1 What can we do with classical bits?
    4. 2.2.2 Abstractions are our friend
    5. 2.3 Qubits: States and operations
    6. 2.3.1 State of the qubit
    7. 2.3.2 The game of operations
    8. 2.3.3 Measuring qubits
    9. 2.3.4 Generalizing measurement: Basis independence
    10. 2.3.5 Simulating qubits in code
    11. 2.4 Programming a working QRNG
    12. Summary
  10. 3 Sharing secrets with quantum key distribution
    1. 3.1 All’s fair in love and encryption
    2. 3.1.1 Quantum NOT operations
    3. 3.1.2 Sharing classical bits with qubits
    4. 3.2 A tale of two bases
    5. 3.3 Quantum key distribution: BB84
    6. 3.4 Using a secret key to send secret messages
    7. Summary
  11. 4 Nonlocal games: Working with multiple qubits
    1. 4.1 Nonlocal games
    2. 4.1.1 What are nonlocal games?
    3. 4.1.2 Testing quantum physics: The CHSH game
    4. 4.1.3 Classical strategy
    5. 4.2 Working with multiple qubit states
    6. 4.2.1 Registers
    7. 4.2.2 Why is it hard to simulate quantum computers?
    8. 4.2.3 Tensor products for state preparation
    9. 4.2.4 Tensor products for qubit operations on registers
    10. Summary
  12. 5 Nonlocal games: Implementing a multi-qubit simulator
    1. 5.1 Quantum objects in QuTiP
    2. 5.1.1 Upgrading the simulator
    3. 5.1.2 Measuring up: How can we measure multiple qubits?
    4. 5.2 CHSH: Quantum strategy
    5. Summary
  13. 6 Teleportation and entanglement: Moving quantum data around
    1. 6.1 Moving quantum data
    2. 6.1.1 Swapping out the simulator
    3. 6.1.2 What other two-qubit gates are there?
    4. 6.2 All the single (qubit) rotations
    5. 6.2.1 Relating rotations to coordinates: The Pauli operations
    6. 6.3 Teleportation
    7. Summary
    8. Part 1: Conclusion
  14. Part 2. Programming quantum algorithms in Q#
  15. 7 Changing the odds: An introduction to Q#
    1. 7.1 Introducing the Quantum Development Kit
    2. 7.2 Functions and operations in Q#
    3. 7.2.1 Playing games with quantum random number generators in Q#
    4. 7.3 Passing operations as arguments
    5. 7.4 Playing Morgana’s game in Q#
    6. Summary
  16. 8 What is a quantum algorithm?
    1. 8.1 Classical and quantum algorithms
    2. 8.2 Deutsch–Jozsa algorithm: Moderate improvements for searching
    3. 8.2.1 Lady of the (quantum) Lake
    4. 8.3 Oracles: Representing classical functions in quantum algorithms
    5. 8.3.1 Merlin’s transformations
    6. 8.3.2 Generalizing our results
    7. 8.4 Simulating the Deutsch–Jozsa algorithm in Q#
    8. 8.5 Reflecting on quantum algorithm techniques
    9. 8.5.1 Shoes and socks: Applying and undoing quantum operations
    10. 8.5.2 Using Hadamard instructions to flip control and target
    11. 8.6 Phase kickback: The key to our success
    12. Summary
  17. 9 Quantum sensing: It’s not just a phase
    1. 9.1 Phase estimation: Using useful properties of qubits for measurement
    2. 9.1.1 Part and partial application
    3. 9.2 User-defined types
    4. 9.3 Run, snake, run: Running Q# from Python
    5. 9.4 Eigenstates and local phases
    6. 9.5 Controlled application: Turning global phases into local phases
    7. 9.5.1 Controlling any operation
    8. 9.6 Implementing Lancelot’s best strategy for the phase-estimation game
    9. Summary
    10. Part 2: Conclusion
  18. Part 3. Applied quantum computing
  19. 10 Solving chemistry problems with quantum computers
    1. 10.1 Real chemistry applications for quantum computing
    2. 10.2 Many paths lead to quantum mechanics
    3. 10.3 Using Hamiltonians to describe how quantum systems evolve in time
    4. 10.4 Rotating around arbitrary axes with Pauli operations
    5. 10.5 Making the change we want to see in the system
    6. 10.6 Going through (very small) changes
    7. 10.7 Putting it all together
    8. Summary
  20. 11 Searching with quantum computers
    1. 11.1 Searching unstructured data
    2. 11.2 Reflecting about states
    3. 11.2.1 Reflection about the all-ones state
    4. 11.2.2 Reflection about an arbitrary state
    5. 11.3 Implementing Grover’s search algorithm
    6. 11.4 Resource estimation
    7. Summary
  21. 12 Arithmetic with quantum computers
    1. 12.1 Factoring quantum computing into security
    2. 12.2 Connecting modular math to factoring
    3. 12.2.1 Example of factoring with Shor’s algorithm
    4. 12.3 Classical algebra and factoring
    5. 12.4 Quantum arithmetic
    6. 12.4.1 Adding with qubits
    7. 12.4.2 Multiplying with qubits in superposition
    8. 12.4.3 Modular multiplication in Shor’s algorithm
    9. 12.5 Putting it all together
    10. Summary
    11. Wrapping up
  22. appendix A. Installing required software
    1. A.1 Running samples online
    2. A.1.1 Using Binder
    3. A.1.2 Using GitHub Codespaces
    4. A.2 Installing locally using Anaconda
    5. A.2.1 Installing Anaconda
    6. A.2.2 Installing packages with Anaconda
    7. A.3 Installing the Quantum Development Kit
    8. A.3.1 Installing the .NET Core SDK
    9. A.3.2 Installing the project templates
    10. A.3.3 Installing the Visual Studio Code extension
    11. A.3.4 Installing IQ# for Jupyter Notebook
  23. appendix B. Glossary and quick reference
    1. B.1 Glossary
    2. B.2 Dirac notation
    3. B.3 Quantum operations
    4. B.4 Q# Language
    5. B.4.1 Types
    6. B.4.2 Q# declarations and statements
    7. B.4.3 Q# expressions and operators
    8. B.4.4 Q# standard libraries
    9. B.4.5 IQ# magic commands
  24. appendix C. Linear algebra refresher
    1. C.1 Approaching vectors
    2. C.2 Seeing the matrix for ourselves
    3. C.2.1 Party with inner products
  25. appendix D. Exploring the Deutsch–Jozsa algorithm by example
    1. D.1 Using our skills to try things
    2. D.2 Step 1: Preparing the input state for Deutsch–Jozsa
    3. D.3 Step 2: Applying the oracle
    4. D.3.1 Example 1: The “id” oracle
    5. D.3.2 Example 2: The “not” oracle
    6. D.3.3 Example 3: The “zero” oracle
    7. D.4 Steps 3 and 4: Undo the preparation on the target qubit, and measure
  26. index
3.15.5.183