<jupyter_start><jupyter_text>Task I: Quantum Computing Part1. implement a simple quantum operation with Cirq    a. With 5 qubits    b. Apply Hadamard operation on every qubit    c. Apply CNOT operation on (0,1), (1,2), (2, 3), (3, 4)    d. SWAP (0, 4)    e. Rotate X with pi/2    f. Plot the circuit<jupyter_code>!pip install --quiet cirq
import cirq
from cirq.contrib.svg import SVGCircuit
import numpy as np
%matplotlib inline
from matplotlib import pyplot as plt
circuit = cirq.Circuit([cirq.H(q) for q in cirq.LineQubit.range(5)]) # circuit with 5 qubits and applying Hadamard on every qubit
circuit.append([cirq.CNOT(q, q+1) for q in cirq.LineQubit.range(4)]) # adding CNOT operation on (0,1), (1,2), (2, 3), (3, 4) 
circuit.append([cirq.SWAP(q, q+4) for q in cirq.LineQubit.range(1)]) # adding SWAP (0, 4)
circuit.append([cirq.rx(np.pi/2).on(q) for q in cirq.LineQubit.range(1)]) # adding rotate X with pi/2
SVGCircuit(circuit) # plotting the circuit<jupyter_output>findfont: Font family ['Arial'] not found. Falling back to DejaVu Sans.<jupyter_text>2. Create a circuit that is a series of small cirq.Rx rotations and plot the probabilityof measuring the state in the |0⟩ state.<jupyter_code>rot1 = cirq.rx(0.01) # small rotation angle 1
rot2 = cirq.rx(0.001) # small rotation angle 2
rot3 = cirq.rx(0.11) # small rotation angle 3
q = cirq.NamedQubit('qubit') # declared a qubit with name 'qubit'
circuit = cirq.Circuit([rot1(q), rot2(q), rot3(q)]) # creating a circuit with 3 small rotations in series
SVGCircuit(circuit) # printing the circuit
s = cirq.Simulator() # declaring the circuit simulator
result = s.simulate(circuit) # simulating the circuit
state_vector = result.final_state_vector # getting the final state vector
print('Probability of measuring the state in the |0> state is:', np.abs(state_vector[0])**2) # Probability of measuring 0
                                                                                             # is |alpha|^2 if final state vector
                                                                                             # is [alpha, beta]^T in (|0>, |1>) basis<jupyter_output>Probability of measuring the state in the |0> state is: 0.9963440991725747
{'fraction_non_alphanumeric': 0.10719131614654002, 'fraction_numerical': 0.03573043871551334, 'mean_word_length': 3.1345794392523363, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '259316', 'license': 'MIT', 'n_tokens_mistral': 762, 'n_tokens_neox': 704, 'n_words': 254, 'path': 'QML_HEP_GSoC_2021_Task_1.ipynb', 'repo_name': 'Ipsit1234/QML-HEP-Evaluation-Test-GSOC-2021', 'size': '2211'}