✅ Put your name here

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#In-Class Assignment 24: Programming Quantum Computers

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In this assignment, we'll use what we learned about quantum bits and quantum circuits in previous assignments to do useful computation. We'll continue using Qiskit to write quantum algorithms (i.e., algorithms for quantum computers). You'll use a quantum computer simulator to test your algorithms, and you'll even get the chance to run the algorithms you wrote on real quantum computers!" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Itinerary

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "Assignment | Topic | Description |

Pre Class 23 | Background for Quantum Computing | How Computers Store Information |

In Class 23 | Classsical and Quantum Bits | Information in Quantum States |

Pre Class 24 | Software for Quantum Computing | High Level Software and the Circuit Model |

In Class 24 | Programming Quantum Computers | Manipulating Quantum Bits to Perform Useful Computations |

Learning Goals

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The learning goals for this assignment are:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "1. Be able to write quantum circuits in Qiskit to perform useful computation such as generating random numbers.\n", "1. Understand how qubits can be \"copied\" using the quantum teleportation protocol.\n", "1. Reflect on the strengths/weaknesses and opportunities/challenges for quantum computing." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Recap of Pre-Class Assignment: Quantum Circuits

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Here, we breifly recap aPart 1: Quantum Random Number Generator

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In this problem, you'll get the chance to write a quantum algorithm that produces a random bit. We explored this problem when we wrote our own `Qubit` class in the previous In Class Assignment. Now, you'll use Qiskit to do this." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Step 1: Set up the Quantum Circuit

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "✎Step 2: Run the Circuit and Display the Results

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now that we have a quantum circuit, we need something to execute its instructions, called aStep 3: Extend the Random Number Generator

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You should have seen roughly equal frequencies of 0 and 1 outcomes above. Now, the problem we want to solve is this:Executing on a Real Quantum Computer

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now that you have a quantum circuit written, you can easily change the `backend` to run it on a real quantum computer rather than a quantum computer simulator. In order to use real quantum computers, you'll need to set up an account on the IBM Q website and get an API Token. If you haven't done this already, the steps are listed below.\n", "\n", "Part 2: Quantum Teleportation Algorithm

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "During In Class Assignment 23, we talked about the differences between copying a bit and copying a qubit. To copy a bit, it's easy: you just look at the bit's value, record it, and write it into a new bit. For a qubit, on the other hand, which has a wavefunction which \"gets destroyed\" when you measure it, the problem is a bit more subtle. \n", "\n", "As copying information is such an important routine in communication and computation, you may wonder if there's anything we can do? Luckily, there is, but it involvesStep 1: Bob Prepares an EPR Pair

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To prepare an EPR pair, it's as easy as two operations, one of which we already know: A Hadamard gate!\n", "\n", "The other operation is called a---------------- Brief Remark about EPR Pairs and Quantum Entanglement ----------------

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "An EPR pair has special properties that quantum teleportation exploits. Below, we create an EPR Pair with two qubits. An EPR pair shows an example of---------------- End Brief Remark about EPR Pairs and Quantum Entanglement ----------------

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now back to the teleportation circuit, which exploits quantum entanglement." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "✎Step 2: Alice Reverses Bob's Operations and Measures

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now we imagine Bob sends his qubit to Alice, who could in theory be as far away as she wishes. Once Alice receives the qubit (which is right away for us), she reverses the operations that Bob performed on her two qubits and measures." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "✎Step 3: Bob Performs Conditional Operations

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now we imagine that Alice sends the results of her measurements to Bob. Remember, her measurements are just bits, so there's no problem communicating them to Bob.Step 4: Run the Circuit

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You've now written the entire quantum teleportation algorithm! Congrats! All that's left to do is execute the circuit in the same way we've done before." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "✎Part 3: Other Quantum Algorithms

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You've just written two quantum algorithms, congrats! The first quantum algorithm, the random number generator, is useful because it generatesAssignment Wrap-up

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Take a moment to fill out the following brief survey to complete your assignment." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Survey

" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from IPython.display import HTML\n", "HTML(\n", "\"\"\"\n", "\n", "\"\"\"\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "##Congrats, You're Finished!

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now, you just need to submit this assignment by uploading it to the course Desire2Learn web page for today's submission folder. (Don't forget to add your name in the first cell.)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**© Copyright 2019, Michigan State University Board of Trustees.**