Preface
IBM Quantum Experience is a platform that enables developers to learn the basics of quantum computing by allowing them to run experiments on a quantum computing simulator and a real device. This book will explain the basic principles of quantum computing, along with one principle of quantum mechanics, entanglement, and the implementation of quantum algorithms and experiments on IBM's quantum processors.
This book provides you with a step-by-step introduction to quantum computing using the IBM Quantum Experience platform. You will learn how to build quantum programs on your own, discover early use cases in your business, and help to get your company equipped with quantum computing skills.
You will start working with simple programs that illustrate quantum computing principles and slowly work your way up to more complex programs and algorithms that leverage advanced quantum computing algorithms. As you build on your knowledge, you'll understand the functionality of the IBM Quantum Experience and the various resources it offers.
We'll explore quantum computing principles such as superposition, entanglement, and interference, then we'll become familiar with the contents and layout of the IBM Quantum Experience dashboard.
Then, we'll understand quantum gates and how they operate on qubits and discover the Quantum Information Science Kit (Qiskit) and its elements such as Terra and Aer.
We'll then get to grips with quantum algorithms such as Deutsch-Jozsa, Simon, Grover, and Shor's algorithms, and then visualize how to create a quantum circuit and run the algorithms on any of the available quantum computers hosted on the IBM Quantum Experience.
Furthermore, you'll learn the differences between the various quantum computers and the different types of simulators available. Later, you'll explore the basics of quantum hardware, pulse scheduling, quantum volume, and how to analyze and optimize your quantum circuits, all while using the resources available on the IBM Quantum Experience.
By the end of this book, you'll have learned how to build quantum programs on your own and will have gained practical quantum computing skills that you can apply to your research or industry.
Who this book is for
This book is for Python developers who are interested in learning about quantum computing and expanding their abilities to solve classically intractable problems with the help of the IBM Quantum Experience and Qiskit. Some background in computer science, physics, and some linear algebra is required.
What this book covers
Chapter 1, Exploring the IBM Quantum Experience, will be your guide to the IBM Q Experience dashboard. This chapter will describe the layout and what each section in the dashboard means. The dashboard might alter over time, but the basic information should still be available to you.
Chapter 2, Circuit Composer – Creating a Quantum Circuit, will help you learn about Circuit Composer. This chapter will outline the user interface that will assist you in learning about quantum circuits, the qubits, and their gates that are used to perform operations on each qubit.
Chapter 3, Creating Quantum Circuits Using Quantum Lab Notebooks, will help you learn how to create circuits using the Notebook with the latest version of Qiskit already installed on the IBM Quantum Experience. You will learn how to save, import, and leverage existing circuits without having to install anything on your local machine.
Chapter 4, Understanding Basic Quantum Computing Principles, will help you learn about the basic quantum computing principles used by the IBM Quantum systems, particularly, superposition, entanglement, and interference. These three properties, often used together, serve as the base differentiators that separate quantum systems from classical systems.
Chapter 5, Understanding the Quantum Bit (Qubit), will help you learn about the basic fundamental component of a quantum system, the quantum bit or qubit, as it is often called. After reading this chapter, you will understand the basis states of a qubit, how they are measured, and how they can be visualized both mathematically and graphically.
Chapter 6, Understanding Quantum Logic Gates, will help you learn how to perform operations on a qubit. These operations are often referred to as quantum gates. This chapter will enable you, via the IBM Quantum Experience, to get to grips with the operations that each of these quantum gates performs on a qubit and the results of each of those operations. Examples of the quantum principles such as reversibility, which is a core principle for all quantum gates, will be included.
Chapter 7, Introducing Qiskit and its Elements, will help you learn about Qiskit and all of its libraries that can help you develop and implement various quantum computing solutions. Qiskit is composed of four elements, each of which has a specific functionality and role that can be leveraged based on the areas you wish to experiment in. The elements are Terra (Earth), Aer (Air), Ignis (Fire), and Aqua (Water). This chapter will also discuss how to contribute to each of the elements and how to install it locally on your machine.
Chapter 8, Programming with Qiskit Terra, will help you learn about the basic foundational element, Terra. Terra is the base library upon which all the other elements of Qiskit are built. Terra allows a developer to code the base of an algorithm to the specific operator on a qubit. This is analogous to assembly language with just a slightly easier set of library functions. It will also include a section on the Pulse library, which allows you to create pulse schedules to manipulate the quantum qubits via the hardware.
Chapter 9, Monitoring and Optimizing Quantum Circuits, will help you learn how to monitor the job requests sent to either the simulator or the quantum computers on the IBM Quantum Experience. Optimization features will also be covered here to allow you to leverage many of the existing optimization features included in the Qiskit libraries or to create your own custom optimizers.
Chapter 10, Executing Circuits Using Qiskit Aer, will help you learn about Qiskit Aer, a high-performance framework that you will use to simulate your circuits on various optimized simulator backends. You will learn what the differences are between the four various simulators of Qasm, State vector, Unitary, and Pulse, and what functionality each one exhibits. Aer also contains tools you can use to construct noise models, should you need to perform some research to reproduce errors due to noise.
Chapter 11, Mitigating Quantum Errors Using Ignis, will help you learn about the various errors that currently affect experiments on read devices, such as relaxation and decoherence, so you can design quantum error correction codes. You will also learn about readout error mitigation, which is a way to mitigate the readout errors returned from a quantum computer.
Chapter 12, Learning about Qiskit Aqua, will, in essence, pull everything together so that end users such as researchers and developers from the various domains of chemistry, machine learning, finance, optimization, and more can run their computations on a quantum computer system without having to know all the inner workings. Aqua is the tool connected to quantum algorithms that has been created to do just that. You will learn how to extend your classical application to include running a quantum algorithm.
Chapter 13, Understanding Quantum Algorithms, will dig into some basic algorithms using the IBM Quantum Experience Composer. This chapter will start with some simple algorithms that illustrate the advantages of superposition and entanglement, such as Bell's state theorem, and extends into some more common algorithms to solve some problems that illustrate uses of superposition and entanglement such as Deutsch-Josza and a few others, each of which provides some variance to the different algorithm types.
Chapter 14, Applying Quantum Algorithms, describes the various quantum computing properties and algorithms used to create some of the more well-known algorithms such as Quantum Amplitude Estimation, Variational Quantum Eigensolvers, and Shor's algorithm.
Appendix A, Resources, will help you get familiar with all the available resources in the IBM Quantum Experience and Qiskit community. These resources that have been contributed either by the Qiskit open source community, or the IBM Quantum research teams themselves. The information is laid out so anyone with basic to expert-level knowledge can jump in and start learning. There is a full quantum course, textbook, and Slack community that you can connect to in order to extend your learning and collaborate with others.
Assessments contains the answers to the questions asked in the chapters.
To get the most out of this book
You will need to have internet access to connect to the IBM Quantum Experience. Since the IBM Quantum Experience is hosted on the IBM Cloud, you will not need anything more other than a supported browser and to register with the IBM Quantum Experience. Everything else is taken care of on the IBM Quantum Experience.
If you are using the digital version of this book, we advise you to type the code yourself or access the code via the GitHub repository (link available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.
Download the example code files
You can download the example code files for this book from your account at www.packt.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.
You can download the code files by following these steps:
- Log in or register at www.packt.com.
- Select the Support tab.
- Click on Code Downloads.
- Enter the name of the book in the Search box and follow the onscreen instructions.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
- WinRAR/7-Zip for Windows
- Zipeg/iZip/UnRarX for Mac
- 7-Zip/PeaZip for Linux
The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Learn-Quantum-Computing-with-Python-and-IBM-Quantum-Experience. In case there's an update to the code, it will be updated on the existing GitHub repository.
We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
Code in Action
Code in Action videos for this book can be viewed at https://bit.ly/35o5M80.
Download the color images
We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://static.packt-cdn.com/downloads/9781838981006_ColorImages.pdf.
Conventions used
There are a number of text conventions used throughout this book.
Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "This will initialize our t1, a, and b parameters, which we will use to generate T1Fitter."
A block of code is set as follows:
# Initialize the parameters for the T1Fitter, A, T1, and B
param_t1 = t1*1.2
param_a = 1.0
param_b = 0.0
Any command-line input or output is written as follows:
[[1. 0. 0. ... 0. 0. 0.]
[0. 1. 0. ... 0. 0. 0.]
[0. 0. 1. ... 0. 0. 0.]
...
[0. 0. 0. ... 1. 0. 0.]
[0. 0. 0. ... 0. 1. 0.]
[0. 0. 0. ... 0. 0. 1.]]
Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "As shown in the following screenshot, ibmq_qasm_simulator can run wider circuits than most local machines and has a larger variety of basis gates."
Tips or important notes
Appear like this.
Get in touch
Feedback from our readers is always welcome.
General feedback: If you have questions about any aspect of this book, mention the book title in the subject of your message and email us at customercare@packtpub.com.
Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.
Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at copyright@packt.com with a link to the material.
If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.
Reviews
Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!
For more information about Packt, please visit packt.com.