• Blog
  • /
  • Brace yourself for Quantum Uprising
on December 30, 2019
  • Big Data
  • Others

Note: Before you start reading I assume you have a basic knowledge of how Quantum Computer works. Some of the topics which I recommend before learning how to use Qiskit is the concepts of Superposition, Entanglement, Interference, Bloch Sphere in Quantum Mechanics and Linear Algebra to understand Qubit and Quantum Logic gates better.

Quantum computers are still far from being how Classical computers are today but still, we can develop Quantum software through industry developed tools from Microsoft and IBM. Microsoft currently provides us with their QDK(Quantum Development Kit) which we can learn Quantum programming through Q# (a high-level Quantum focused programming language). The QDK also has a compiler, Q# library, a local Quantum machine simulator. But there’s a catch, here we are not directly working with a real Quantum computer but a simulator.

 But with Qiskit we can directly work with a real Quantum computer. So basically we can access IBM’s Quantum computer through IBM Q experience(via the cloud) with Qiskit. Hence this blog is only about the basic setup you need to start working with Qiskit and how we can run our code in a real Quantum machine. 

First of all! What is Qiskit? It basically stands for Quantum Information Software Kit. It is Python based open-source framework for Quantum computing. We can use it to do Quantum computation on our machine locally or we get an access token from IBM Q experience and with that access token, we can run our code in one of IBM’s Quantum Computer. How cool is that!

Qiskit is mainly made up of four components i.e

  • Terra – For compiling and interacting with the hardware
  • Ignis – for noise and errors
  • Aqua – Algorithms for Optimization, Chemistry and AI
  • Aer – High performance simulators

The graph shows a superpositioned state. 0 has a probability of 0.492 and 1 has a probability of 0.508. Hence it can be two states at once.

The graph shows entangled state. 00 has a probability of 0.507 and 11 has a probability of 0.493 and there is no probability of becoming 01 or 10. Hence the state of target Qubit is always influenced by the control Qubit.

Now we saw  a little overview of what Qiskit can do. The following instruction is for Windows 7 and later, not for Mac OS or Linux. Now let’s see the requirements before we start to Quantum code (pun intended).

  • Anaconda distribution
  • Python 3.5 or later
  • Jupyter notebook

Open Anaconda prompt, then type the following command to install Qiskit

pip install qiskit 

That’s it, You can start using Qiskit if you know how to use it or continue your reading. Now we will use jupyter notebook interface to write Qiskit code. So type

jupyter notebook 

and it will open in your browser

Click new then select python 3

You will get the above window and the first thing you need to do is write Python code to

import qiskit 

and hit shift+enter. If you have Qiskit installed you get the following output.

You will get a new line and In[ ] changes to In[ 1 ] and to check the version of Qiskit is the latest, type the following

qiskit.__qiskit_version__ 

Hence the following shown above is the version of Qiskit and its components at the time of writing this blog. Now is the fun part, we need to get an API token to access IBM’s Quantum computer. So first we need to create an account in https://quantum-computing.ibm.com/login

After logging in, you get the window below, here we can create our own Quantum circuits using Circuit composer(a GUI tool for creating Quantum circuits) or we can use Qiskit Notebooks.

Now to get the access token, click your profile on the top right corner of this page and click My account.

Now click Copy Token then go back to your jupyter notebook, type the following

from qiskit import IBMQ 

and then a new line

IBMQ.save_account()

And in the single Quotes paste your token and hit shift + enter. Now to verify you have access to IBM’s Quantum computer, finally write

IBMQ.load_account()

you should get the following output given below

yay ! you have successfully done it. Now you can write and run your code at a lab in IBM that could be industry related, games or any of your personal interests.

Now before we start creating games or solving the mysteries of the universe using Quantum power when programmers traditionally learn new programming languages or framework we would like to start writing a Hello World application but here we will start with a Hello Quantum World application(pun intended again).

Written By
Shijin MS

Comments(1)

avatar
1 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
sutharsanank Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
sutharsanank
Guest
sutharsanank

Good..Work ..