Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/guides/_toc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
"title": "Introduction to Qiskit",
"url": "/docs/guides"
},
{
"title": "Quick start",
"url": "/docs/guides/quick-start"
},
{
"title": "Install",
"children": [
Expand Down
1 change: 1 addition & 0 deletions docs/guides/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,6 @@ You can find a catalog of projects in the [Qiskit ecosystem page](https://qiskit
## Next steps

<Admonition type="tip" title="Recommendations">
- Build your first circuit with the [Quick start](/docs/guides/quick-start) guide.
- [Install the Qiskit SDK and Qiskit Runtime](/docs/guides/install-qiskit).
</Admonition>
262 changes: 262 additions & 0 deletions docs/guides/quick-start.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,262 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "2e2023d1",
"metadata": {},
"source": [
"# Quick start"
]
},
{
"cell_type": "markdown",
"id": "a82fbaaa",
"metadata": {
"tags": [
"version-info"
]
},
"source": []
},
{
"cell_type": "markdown",
"id": "7bbbdb4b",
"metadata": {
"jp-MarkdownHeadingCollapsed": true
},
"source": [
"Build your first quantum circuit in under two minutes, on your local environment - no sign-in or API key necessary.\n",
"\n",
"<Admonition type=\"note\" title=\"New to Python and virtual environments?\">\n",
"\n",
"* It is recommended to use a Python virtual environment.\n",
"\n",
"<details>\n",
"<summary>Click to expand for more information about **Python**.</summary>\n",
"\n",
"- To install Python, first check the \"Programming Language\" section on the [Qiskit PyPI project page](https://pypi.org/project/qiskit/) to determine which Python versions are supported by the most recent release. For download instructions, see the [Python Beginners Guide.](https://wiki.python.org/moin/BeginnersGuide/Download)\n",
"\n",
"<Admonition type = \"note\">\n",
"These instructions use the standard Python distribution from [pypi.org](https://pypi.org/). However, you can use other Python distributions, such as [Anaconda](https://docs.anaconda.com/anaconda/) or [miniconda](https://docs.anaconda.com/miniconda/), along with other dependency management workflows like [Poetry](https://python-poetry.org/docs/).\n",
"</Admonition>\n",
"</details>\n",
"\n",
" <details>\n",
" <summary>\n",
" Click to expand for more information on **virtual environments**.\n",
" </summary>\n",
" - Use [Python virtual environments](https://docs.python.org/3.10/tutorial/venv.html) to separate Qiskit from other applications.\n",
" A Python virtual environment is an isolated space to work with Python for a specific purpose — so you can install whatever packages you wish, and set up libraries, dependencies, and so on, without affecting the \"base\" Python environment on your machine.\n",
"\n",
" One important advantage of a virtual environment is that if your Python environment becomes corrupted somewhere along the way, you can easily delete the virtual environment and start over!\n",
"\n",
" Choose a preferred location in which to store information about your virtual environments. Typically they're stored in a directory named `.venv` within each project directory you're working in.\n",
"\n",
" To work in your virtual environment, navigate to your project directory and create a minimal environment with only Python installed in it.\n",
"\n",
" <OperatingSystemTabs>\n",
" <TabItem value=\"mac\" label=\"macOS\">\n",
" ```shell\n",
" python3 -m venv .venv\n",
" ```\n",
" </TabItem>\n",
"\n",
" <TabItem value=\"linux\" label=\"Linux\">\n",
" ```shell\n",
" python3 -m venv .venv\n",
" ```\n",
" </TabItem>\n",
"\n",
" <TabItem value=\"win\" label=\"Windows\">\n",
" ```text\n",
" python -m venv .venv\n",
" ```\n",
" </TabItem>\n",
" </OperatingSystemTabs>\n",
"\n",
" Next, activate your new environment.\n",
"\n",
" <OperatingSystemTabs>\n",
" <TabItem value=\"mac\" label=\"macOS\">\n",
" ```shell\n",
" source .venv/bin/activate\n",
" ```\n",
" </TabItem>\n",
"\n",
" <TabItem value=\"linux\" label=\"Linux\">\n",
" ```shell\n",
" source .venv/bin/activate\n",
" ```\n",
" </TabItem>\n",
"\n",
" <TabItem value=\"win\" label=\"Windows\">\n",
" If using PowerShell:\n",
"\n",
" ```text\n",
" .venv\\Scripts\\Activate.ps1\n",
" ```\n",
" If using Git Bash:\n",
"\n",
" ```text\n",
" source .venv/scripts/activate\n",
" ```\n",
" If using command prompt:\n",
"\n",
" ```text\n",
" .venv\\Scripts\\activate\n",
" ```\n",
" </TabItem>\n",
" </OperatingSystemTabs>\n",
" </details>\n",
"\n",
"</Admonition>\n",
"\n",
"\n",
"## 1. Install Qiskit\n",
"\n",
"Run the following command in your terminal to install the Qiskit and Qiskit Aer (local simulation) packages, as well as the Qiskit visualization module.\n",
"\n",
"```shell\n",
"pip install qiskit qiskit-aer qiskit[visualization]\n",
"\n",
"# On a zsh terminal, use this line instead:\n",
"# pip install qiskit qiskit-aer 'qiskit[visualization]'\n",
"```"
]
},
{
"cell_type": "markdown",
"id": "c8da788c",
"metadata": {},
"source": [
"## 2. Build your circuit\n",
"\n",
"Open a Python environment, then run this code, which builds a Bell state (two entangled qubits)."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "86784142",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'00': 505, '11': 519}\n"
]
}
],
"source": [
"from qiskit import QuantumCircuit\n",
"from qiskit.transpiler import generate_preset_pass_manager\n",
"from qiskit_aer import AerSimulator\n",
"\n",
"qc = QuantumCircuit(2)\n",
"qc.h(0)\n",
"qc.cx(0, 1)\n",
"qc.measure_all()\n",
"\n",
"sim = AerSimulator()\n",
"pass_manager = generate_preset_pass_manager()\n",
"\n",
"transpiled = pass_manager.run(qc)\n",
"\n",
"result = sim.run(transpiled, shots=1024).result()\n",
"print(result.get_counts())"
]
},
{
"cell_type": "markdown",
"id": "9a3180c2-56d7-4224-91fa-13d8cb87d93d",
"metadata": {},
"source": [
"The expected output is a near-even split between '00' and '11'."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to explain how to interpret the output? Where the 505 and 519 came from and what they mean?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went back and forth on this. I agree that this gives no explanation or context, which I'm naturally uncomfortable with - but in trying to capture the intention of a quick-start, I'm letting this be a teaser to spark interest (we should of course link out to learn more, but not explain on this page).

]
},
{
"cell_type": "markdown",
"id": "a110ac90",
"metadata": {},
"source": [
"## Visualize your results\n",
"\n",
"To get a histogram of your results, add the following code to your program."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "dc4ff012",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<Image src=\"/docs/images/guides/quick-start/extracted-outputs/dc4ff012-0.avif\" alt=\"Output of the previous code cell\" />"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from qiskit.visualization import plot_histogram\n",
"\n",
"counts = result.get_counts()\n",
"plot_histogram(counts)\n",
"# Include the next line if you are not using Python in a Jupyter notebook\n",
"# plt.show()"
]
},
{
"cell_type": "markdown",
"id": "738d4fc4-29c9-46ab-9879-3365e2149d04",
"metadata": {},
"source": [
"This result is a signature of quantum entanglement.\n",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"This result is a signature of quantum entanglement.\n",
"This result, where the two bars are almost the same height, is a signature of quantum entanglement.\n",

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's more complex than this, right, and has to do with correlation? Again, I think we can't reasonably explain these things in a quick-start guide without weighing it down, and should link out instead. Where to link out to is a bigger question - our learning materials, or some quick and dirty definition of entanglement?

"\n",
"Try changing the code to see how it affects the results. For example, add a third qubit by replacing `qc.cx(0, 1)` with `qc.cx(1, 2)`, or include a bit-flip by adding `qc.x(1)`."
]
},
{
"cell_type": "markdown",
"id": "b6062a16",
"metadata": {},
"source": [
"## Next steps\n",
"\n",
"<Admonition type=\"tip\" title=\"Recommendations\">\n",
"- Run a circuit on real quantum hardware in the [Hello world](/docs/tutorials/hello-world) tutorial.\n",
"- Browse the [IBM Quantum Platform documentation](/docs).\n",
"- Learn how to apply quantum computing to common use cases in [tutorials.](/docs/tutorials)\n",
"</Admonition>"
]
}
],
"metadata": {
"description": "Build and visualize a quantum circuit in under two minutes, no sign-in or API key necessary.",
"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"
},
"title": "Quick start"
},
"nbformat": 4,
"nbformat_minor": 5
}
Binary file not shown.
3 changes: 3 additions & 0 deletions qiskit_bot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,9 @@ notifications:
- "@pandasa123"
- "@johannesgreiner"
- "@Henri-ColibrITD"
"docs/guides/quick-start":
- "@abbycross"
- "@beckykd"
"docs/guides/qiskit-addons-sqd":
- "@kaelynj"
"docs/guides/qiskit-addons-sqd-get-started":
Expand Down
1 change: 1 addition & 0 deletions scripts/config/notebook-testing.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ test-strategies.ci = {}
test-strategies.extended = {}
test-strategies.hardware = { patch="qiskit-ibm-runtime-open" }
notebooks = [
"docs/guides/quick-start.ipynb",
"docs/guides/build-noise-models.ipynb",
"docs/guides/circuit-library.ipynb",
"docs/guides/classical-feedforward-and-control-flow.ipynb",
Expand Down