55 lines
1.4 KiB
Markdown
55 lines
1.4 KiB
Markdown
|
# Learning Qiskit
|
||
|
|
||
|
Sample Code & Getting Started
|
||
|
|
||
|
Step 1: Open up terminal and check for python 3.7+ or install python by following instructions.
|
||
|
|
||
|
```python
|
||
|
#check which version of python you have
|
||
|
python -V
|
||
|
```
|
||
|
|
||
|
Step 2: Then install anaconda
|
||
|
|
||
|
```python
|
||
|
brew cask install anaconda
|
||
|
```
|
||
|
|
||
|
(you can check if it has finished installing by running "jupyter notebook" in the terminal)
|
||
|
|
||
|
Visit [here](https://medium.com/ayuth/install-anaconda-on-macos-with-homebrew-c94437d63a37)(MacOS) or [here](https://medium.com/@GalarnykMichael/install-python-on-mac-anaconda-ccd9f2014072)(Linux & Windows) if you are running into any issues.
|
||
|
|
||
|
Step 3:
|
||
|
|
||
|
**Topics:**
|
||
|
|
||
|
Visualization:
|
||
|
|
||
|
All visualizations found [here](https://nbviewer.jupyter.org/github/qutip/qutip-notebooks/blob/master/examples/visualization-exposition.ipynb)
|
||
|
|
||
|
```python
|
||
|
%matplotlib inline
|
||
|
import matplotlib,pyplot as plt
|
||
|
import numpy as np
|
||
|
from qutip import *
|
||
|
|
||
|
//Hinton
|
||
|
rho = rand_dm(5)
|
||
|
hinto(rho);
|
||
|
|
||
|
//Sphereplot
|
||
|
theta = np.linspace(0, np.pi, 90)
|
||
|
phi = np.linspace(0, 2 * np.pi, 60)
|
||
|
sphereplot(theta, phi, orbital(theta, phi, basis(3, 0)));
|
||
|
|
||
|
//Matrix_histogram
|
||
|
matrix_histogram(rho.full().real);
|
||
|
matrix_histogram_complex(rho.full());
|
||
|
|
||
|
b = Bloch()
|
||
|
b.add_vectors(expect(H.unit(), e_ops))
|
||
|
b.add_points(result.expect, meth='1')
|
||
|
b.make_sphere()
|
||
|
```
|
||
|
|
||
|
Here's a list of all languages that are available for quantum programming:
|