<jupyter_start><jupyter_text>Deutsch's Algorithm<jupyter_code>from qiskit import *
from python_funcs.Named_Gates import *
from qiskit.visualization import plot_histogram

circ = QuantumCircuit(2, 1)
circ.append(Blackbox(),[0,1])
#circ.measure(1,0) #measure
circ.draw(output='mpl') #draw the circuit<jupyter_output><empty_output><jupyter_text>Classical solution  Recall that the black box maps: $$(x,y) \mapsto (x, y+f(x))$$ Obtain $f(0)$<jupyter_code>from python_funcs.Named_Gates import *
circ = BlackboxCircuit(0,0)
circ.draw(output='mpl')
print('The value of f(0) is:')
from python_funcs.Simulate_Plot import *
SimulatePlot(circ)<jupyter_output><empty_output><jupyter_text>Obtain $f(1)$  Recall that the black box maps: $$(x,y) \mapsto (x, y+f(x))$$<jupyter_code>circ = BlackboxCircuit(1,0)
circ.draw(output='mpl')
print('The value of f(1) is:')
SimulatePlot(circ)<jupyter_output><empty_output><jupyter_text>Quantum solution  Query in superposition, and cleverly leverage interference<jupyter_code>from qiskit import *
from qiskit.visualization import plot_histogram

circ = QuantumCircuit(2, 1)
circ.append(One(),[1])
circ.h(0)
circ.h(1)
circ.append(Blackbox(),[0,1])
circ.h(0)
circ.measure(0,0) #measure
circ.draw(output='mpl') #draw the circuit
print('The parity of f(0) + f(1) is:')
SimulatePlot(circ)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15097159940209268, 'fraction_numerical': 0.01943198804185351, 'mean_word_length': 8.845588235294118, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '517045', 'license': 'MIT', 'n_tokens_mistral': 539, 'n_tokens_neox': 511, 'n_words': 102, 'path': 'MIT_sloan_presentation/MIT_Sloan_tech_club_Deutsch.ipynb', 'repo_name': 'qBraid/presentations', 'size': '1338'}