Book Image

Learn Quantum Computing with Python and IBM Quantum Experience

By : Robert Loredo
Book Image

Learn Quantum Computing with Python and IBM Quantum Experience

By: Robert Loredo

Overview of this book

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 quantum computer. This book will explain the basic principles of quantum mechanics, the principles involved in quantum computing, and the implementation of quantum algorithms and experiments on IBM's quantum processors. 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 quantum computing. As you build on your knowledge, you’ll understand the functionality of IBM Quantum Experience and the various resources it offers. Furthermore, you’ll not only learn the differences between the various quantum computers but also the various simulators available. Later, you’ll explore the basics of quantum computing, quantum volume, and a few basic algorithms, all while optimally using the resources available on IBM Quantum Experience. By the end of this book, you'll learn how to build quantum programs on your own and have gained practical quantum computing skills that you can apply to your business.
Table of Contents (21 chapters)
Section 1: Tour of the IBM Quantum Experience (QX)
Section 2: Basics of Quantum Computing
Section 3: Algorithms, Noise, and Other Strange Things in Quantum World
Appendix A: Resources

Executing quantum circuits with custom noise models

We'll create our standard circuit out of a Hadamard and CNOT circuit, which, as we know from earlier, will result in equal probabilities of 00 and 11. Let's now run it with our noise model and see what results we get and compare them:

# Create a simple 2 qubit circuit
qc_error = QuantumCircuit(2,2)
# Place in superposition and entangle
# Measure the qubits to the classical bits.
qc_error.measure(range(2), range(2))

Now that we have our circuit created, we'll add our custom noise model.

Adding custom noise models to our circuits

We'll begin by obtaining the Qasm simulator, calling the execute method and including the usual arguments, namely, circuit, backend, and the number of shots. We'll also include the noise model information. Similar to how we included a thermal relaxation noise model earlier, we will provide the noise model basis_gates, and noise_model. This...