Skip to content

Instantly share code, notes, and snippets.

@cive
Created December 8, 2019 13:19
Show Gist options
  • Select an option

  • Save cive/557d991e34479eed170a0f01482bfaae to your computer and use it in GitHub Desktop.

Select an option

Save cive/557d991e34479eed170a0f01482bfaae to your computer and use it in GitHub Desktop.

Revisions

  1. cive created this gist Dec 8, 2019.
    185 changes: 185 additions & 0 deletions テスト.ipynb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,185 @@
    {
    "cells": [
    {
    "cell_type": "markdown",
    "metadata": {},
    "source": [
    "### てすと\n",
    "このような記事を書くこともできます"
    ]
    },
    {
    "cell_type": "code",
    "execution_count": 1,
    "metadata": {},
    "outputs": [],
    "source": [
    "import scipy"
    ]
    },
    {
    "cell_type": "code",
    "execution_count": 2,
    "metadata": {},
    "outputs": [],
    "source": [
    "import qutip"
    ]
    },
    {
    "cell_type": "code",
    "execution_count": 3,
    "metadata": {},
    "outputs": [],
    "source": [
    "ket0 = qutip.Qobj([[1], [0]])"
    ]
    },
    {
    "cell_type": "code",
    "execution_count": 4,
    "metadata": {},
    "outputs": [
    {
    "data": {
    "text/latex": [
    "Quantum object: dims = [[2], [1]], shape = (2, 1), type = ket\\begin{equation*}\\left(\\begin{array}{*{11}c}1.0\\\\0.0\\\\\\end{array}\\right)\\end{equation*}"
    ],
    "text/plain": [
    "Quantum object: dims = [[2], [1]], shape = (2, 1), type = ket\n",
    "Qobj data =\n",
    "[[1.]\n",
    " [0.]]"
    ]
    },
    "execution_count": 4,
    "metadata": {},
    "output_type": "execute_result"
    }
    ],
    "source": [
    "ket0"
    ]
    },
    {
    "cell_type": "code",
    "execution_count": 5,
    "metadata": {},
    "outputs": [
    {
    "data": {
    "text/latex": [
    "Quantum object: dims = [[2], [1]], shape = (2, 1), type = ket\\begin{equation*}\\left(\\begin{array}{*{11}c}1.0\\\\0.0\\\\\\end{array}\\right)\\end{equation*}"
    ],
    "text/plain": [
    "Quantum object: dims = [[2], [1]], shape = (2, 1), type = ket\n",
    "Qobj data =\n",
    "[[1.]\n",
    " [0.]]"
    ]
    },
    "execution_count": 5,
    "metadata": {},
    "output_type": "execute_result"
    }
    ],
    "source": [
    "qutip.basis(2,0)"
    ]
    },
    {
    "cell_type": "code",
    "execution_count": 6,
    "metadata": {},
    "outputs": [
    {
    "data": {
    "text/latex": [
    "Quantum object: dims = [[2], [1]], shape = (2, 1), type = ket\\begin{equation*}\\left(\\begin{array}{*{11}c}0.0\\\\1.0\\\\\\end{array}\\right)\\end{equation*}"
    ],
    "text/plain": [
    "Quantum object: dims = [[2], [1]], shape = (2, 1), type = ket\n",
    "Qobj data =\n",
    "[[0.]\n",
    " [1.]]"
    ]
    },
    "execution_count": 6,
    "metadata": {},
    "output_type": "execute_result"
    }
    ],
    "source": [
    "qutip.basis(2,1)"
    ]
    },
    {
    "cell_type": "code",
    "execution_count": 7,
    "metadata": {},
    "outputs": [],
    "source": [
    "phi=qutip.sigmay()*qutip.qip.gates.hadamard_transform()*ket0"
    ]
    },
    {
    "cell_type": "code",
    "execution_count": 8,
    "metadata": {},
    "outputs": [
    {
    "data": {
    "text/plain": [
    "1.0"
    ]
    },
    "execution_count": 8,
    "metadata": {},
    "output_type": "execute_result"
    }
    ],
    "source": [
    "phi.norm()"
    ]
    },
    {
    "cell_type": "markdown",
    "metadata": {},
    "source": [
    "ここまで、 qutip の基本的な使い方でした。\n",
    "\n",
    "\n",
    "\n",
    "基本的すぎる!!!"
    ]
    },
    {
    "cell_type": "code",
    "execution_count": null,
    "metadata": {},
    "outputs": [],
    "source": []
    }
    ],
    "metadata": {
    "kernelspec": {
    "display_name": "Python 3",
    "language": "python",
    "name": "python3"
    },
    "language_info": {
    "codemirror_mode": {
    "name": "ipython",
    "version": 3
    },
    "file_extension": ".py",
    "mimetype": "text/x-python",
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
    "version": "3.7.4"
    }
    },
    "nbformat": 4,
    "nbformat_minor": 4
    }