Quantum Computing in Practice with Qiskit® and IBM Quantum Experience®
eBook - ePub

Quantum Computing in Practice with Qiskit® and IBM Quantum Experience®

Practical recipes for quantum computer coding at the gate and algorithm level with Python

Hassi Norlén

Share book
  1. 408 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Quantum Computing in Practice with Qiskit® and IBM Quantum Experience®

Practical recipes for quantum computer coding at the gate and algorithm level with Python

Hassi Norlén

Book details
Book preview
Table of contents
Citations

About This Book

Understand the nuances of programming traditional quantum computers and solve the challenges of the future while building and executing quantum programs on IBM Quantum hardware and simulators

Key Features

  • Work your way up from writing a simple quantum program to programming complex quantum algorithms
  • Explore the probabilistic nature of qubits by performing quantum coin tosses and using random number generators
  • Delve into quantum algorithms and their practical applications in various domains

Book Description

IBM Quantum Experience® is a leading platform for programming quantum computers and implementing quantum solutions directly on the cloud. This book will help you get up to speed with programming quantum computers and provide solutions to the most common problems and challenges.

You'll start with a high-level overview of IBM Quantum Experience® and Qiskit®, where you will perform the installation while writing some basic quantum programs. This introduction puts less emphasis on the theoretical framework and more emphasis on recent developments such as Shor's algorithm and Grover's algorithm. Next, you'll delve into Qiskit®, a quantum information science toolkit, and its constituent packages such as Terra, Aer, Ignis, and Aqua. You'll cover these packages in detail, exploring their benefits and use cases. Later, you'll discover various quantum gates that Qiskit® offers and even deconstruct a quantum program with their help, before going on to compare Noisy Intermediate-Scale Quantum (NISQ) and Universal Fault-Tolerant quantum computing using simulators and actual hardware. Finally, you'll explore quantum algorithms and understand how they differ from classical algorithms, along with learning how to use pre-packaged algorithms in Qiskit® Aqua.

By the end of this quantum computing book, you'll be able to build and execute your own quantum programs using IBM Quantum Experience® and Qiskit® with Python.

What you will learn

  • Visualize a qubit in Python and understand the concept of superposition
  • Install a local Qiskit® simulator and connect to actual quantum hardware
  • Compose quantum programs at the level of circuits using Qiskit® Terra
  • Compare and contrast Noisy Intermediate-Scale Quantum computing (NISQ) and Universal Fault-Tolerant quantum computing using simulators and IBM Quantum® hardware
  • Mitigate noise in quantum circuits and systems using Qiskit® Ignis
  • Understand the difference between classical and quantum algorithms by implementing Grover's algorithm in Qiskit®

Who this book is for

This book is for developers, data scientists, machine learning researchers, or quantum computing enthusiasts who want to understand how to use IBM Quantum Experience® and Qiskit® to implement quantum solutions and gain practical quantum computing experience. Python programming experience is a must to grasp the concepts covered in the book more effectively. Basic knowledge of quantum computing will also be beneficial.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Quantum Computing in Practice with Qiskit® and IBM Quantum Experience® an online PDF/ePUB?
Yes, you can access Quantum Computing in Practice with Qiskit® and IBM Quantum Experience® by Hassi Norlén in PDF and/or ePUB format, as well as other popular books in Ciencia de la computación & Ciencias computacionales general. We have over one million books available in our catalogue for you to explore.

Information

Chapter 1: Preparing Your Environment

Before you can start working on your quantum programs, you must have a Python environment to execute your code. The examples in this book can be run both on your local machine by using the Qiskit® developer environment provided by IBM Quantum® and in an online environment on IBM Quantum Experience®.
In this chapter, we will take a look at both environments, get you a login account on IBM Quantum Experience®, and install a local version of Qiskit®. We will also discuss the fast-moving environment that is open source Qiskit®, and how to keep your local environment up to date.
We will cover the following recipes:
  • Creating your IBM Quantum Experience® account
  • Installing Qiskit®
  • Downloading the code samples
  • Installing your API key and accessing your provider
  • Keeping your Qiskit® environment up to date
So, let's get started. This chapter, and its contents, is pretty important as it provides you with the foundation on which you can start building your Qiskit® future. Do spend a moment or two setting this up, and then get going with the recipes in this book to get started with quantum programming on Qiskit®. To get you started quickly, you can also grab and run the sample recipe code that is provided with this book.

Technical requirements

The recipes that we will discuss in this chapter can be found here: https://github.com/PacktPublishing/Quantum-Computing-in-Practice-with-Qiskit-and-IBM-Quantum-Experience/tree/master/Chapter01.
You can run the recipes in this book in your local Qiskit® environment that you set up as a part of this chapter. You can also run most of them in the Quantum Lab environment of the online IBM Quantum Experience®. This is also true for the c1_r1_version.py recipe in this chapter, which lists the installed version of Qiskit® in the environment in which you run the recipe.
For information about how to download the recipes, see Downloading the code samples.
The local environment in which you choose to install Qiskit® must have Python 3.5 or higher installed (as of this book's writing). For detailed information about the most current requirements for Qiskit® installation, see the Qiskit® requirements page at https://qiskit.org/documentation/install.html.
IBM Quantum® recommends using the Anaconda distribution of Python (https://www.anaconda.com/distribution/), and to use virtual environments to keep your Qiskit® installation isolated from your usual Python environment.
New to virtual environments?
Virtual environments provide isolated Python environments that you can modify separately from each other. For example, you can create an isolated environment for your Qiskit® installation. You will then install Qiskit® only in that environment, and not touch the Python framework in the base environment which will then contain an untarnished version of Python.
As Qiskit® releases new versions of their packages, there is technically nothing stopping you from creating a new isolated environment for each updated version of Qiskit® to retain your old and stable version for your Qiskit® quantum programming, and a new environment where you can test updated versions of Qiskit®. You will find more on this in the Keeping your Qiskit® environment up to date recipe.

Creating your IBM Quantum Experience® account

Your key to exploring quantum computer programming with IBM is your IBM Quantum Experience® account. This free account gives you access to the online IBM Quantum Experience® interface, and the programming tools that are available there. An IBM Quantum Experience® account is not technically required to test out IBM Quantum Experience® or to install Qiskit® but is required to run your programs on the freely available IBM quantum computers, which are, after all, probably why you are reading this book in the first place.

Getting ready

To set up your IBM Quantum Experience® account, you can log in with an IBMid, or with one of the following:
  • A Google account
  • A GitHub account
  • A LinkedIn account
  • A Twitter account
  • An email address

How to do it...

  1. In your browser (Google Chrome seems to work best), go to this link: https://quantum-computing.ibm.com/login.
  2. Enter your IBMid credentials or select another login method.
    You can also skip the sign-in, which will give you access to IBM Quantum Experience® but with a limit of 3 qubits for your quantum circuits, and with simulator backends only.
  3. Once you have logged in, you now have an activated IBM Quantum Experience® account, and will find yourself at the main dashboard:
    Figure 1.1 – The IBM Quantum Experience® home page
    Figure 1.1 – The IBM Quantum Experience® home page
  4. From here, you have a couple of paths:
    Go to a composer to start building your quantum programs in a graphical user interface. Click the Circuit composer left-menu icon (
    ) and then go to Chapter 3, IBM Quantum Experience® – Quantum Drag and Drop.
    If you want to start writing your quantum programs in Python without first installing a local Qiskit® instance, you can go to the Qiskit® notebooks to start working on your quantum programs in a Jupyter Notebook Python environment. Click on the Quantum Lab left-menu icon (
    A picture containing drawing

Description automatically generated
    ), click New Notebook, and then go to Chapter 4, Starting at the Ground Level with Terra.
    If you want to continue down the Qiskit® path for which this book was written, you can now log out of IBM Quantum Experience®, and continue with installing Qiskit® on your local machine.

See also

  • IBM Quantum Experience is quantum on the cloud: https://www...

Table of contents