Commit 2ed3c571 authored by Michael Wimmer's avatar Michael Wimmer

copy material over from the programming course

parent ab2cd451
# year hare lynx carrot
1900 30e3 4e3 48300
1901 47.2e3 6.1e3 48200
1902 70.2e3 9.8e3 41500
1903 77.4e3 35.2e3 38200
1904 36.3e3 59.4e3 40600
1905 20.6e3 41.7e3 39800
1906 18.1e3 19e3 38600
1907 21.4e3 13e3 42300
1908 22e3 8.3e3 44500
1909 25.4e3 9.1e3 42100
1910 27.1e3 7.4e3 46000
1911 40.3e3 8e3 46800
1912 57e3 12.3e3 43800
1913 76.6e3 19.5e3 40900
1914 52.3e3 45.7e3 39400
1915 19.5e3 51.1e3 39000
1916 11.2e3 29.7e3 36700
1917 7.6e3 15.8e3 41800
1918 14.6e3 9.7e3 43300
1919 16.2e3 10.1e3 41300
1920 24.7e3 8.6e3 47300
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
font = {'family' : 'sans',
'size' : 14}
matplotlib.rc('font', **font)
def plot_function(f):
n = 100
C = np.zeros(shape=(n, n))
for i in range(C.shape[0]):
for j in range(C.shape[1]):
C[i, j] = f(j/n*10, i/n*10)
fig = plt.figure(figsize=(5.4, 4))
ax = fig.add_subplot(111, aspect='equal')
plt.pcolormesh(np.linspace(0, 10, n), np.linspace(0, 10, n),
C, cmap='jet', vmin=0, vmax=5)
plt.colorbar()
plt.xlabel('x')
plt.ylabel('y')
plt.show()
This diff is collapsed.
This diff is collapsed.
qubit q0 # Define a qubit
h q0 # Apply a Hadamard gate
measure q0 # Measure in computational basis
#
# File: test1.qasm
# Date: 22-Mar-04
# Author: I. Chuang <ichuang@mit.edu>
#
# Sample qasm input file - EPR creation
#
qubit q0
qubit q1
h q0 # create EPR pair
cnot q0,q1
#
# File: test3.qasm
# Date: 22-Mar-04
# Author: I. Chuang <ichuang@mit.edu>
#
# Sample qasm input file - simple teleportation circuit
#
qubit q0
qubit q1
qubit q2
h q1 # create EPR pair
cnot q1,q2
cnot q0,q1 # Bell basis measurement
h q0
nop q1
measure q0
measure q1
c-z q1,q2 # correction step
c-x q0,q2
#
# File: test4.qasm
# Date: 22-Mar-04
# Author: I. Chuang <ichuang@mit.edu>
#
# Sample qasm input file - swap circuit
#
qubit q0
qubit q1
cnot q0,q1
cnot q1,q0
cnot q0,q1
This diff is collapsed.
<style>
.rendered_html pre code {
background-color: transparent;
}
.rendered_html pre {
background-color: #eee;
color: #6e5494
border-color: #dFb5b4;
border-left: 5px solid #6e5494;
padding: 0.5em;
}
</style>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="126.90775mm"
height="41.810688mm"
viewBox="0 0 126.90775 41.810688"
version="1.1"
id="svg4582"
inkscape:version="0.92.1 r15371"
sodipodi:docname="permissions.svg">
<defs
id="defs4576" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.98994949"
inkscape:cx="159.52948"
inkscape:cy="-21.663825"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="1888"
inkscape:window-height="1025"
inkscape:window-x="14"
inkscape:window-y="37"
inkscape:window-maximized="0" />
<metadata
id="metadata4579">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0.37847557,-83.295032)">
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:6.61458349px;font-family:Inconsolata;-inkscape-font-specification:Inconsolata;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="2.6673896"
y="95.251549"
id="text4487"><tspan
sodipodi:role="line"
id="tspan4485"
x="2.6673896"
y="101.94551"
style="stroke-width:0.26458332px" /><tspan
sodipodi:role="line"
x="2.6673896"
y="108.56009"
style="fill:#4d4d4d;stroke-width:0.26458332px"
id="tspan4489"><tspan
style="fill:#ff5555"
id="tspan5890">rwx</tspan><tspan
style="fill:#2a7fff"
id="tspan5892">rw-</tspan><tspan
style="fill:#37c837"
id="tspan5894">r-x</tspan></tspan></text>
<path
style="fill:none;fill-rule:evenodd;stroke:#4d4d4d;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 3.7789476,100.03404 V 95.699823 H 18.37478 v 4.334217"
id="path4515"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
<path
sodipodi:nodetypes="cccc"
inkscape:connector-curvature="0"
id="path5874"
d="m 19.984677,110.03539 v 4.33422 h 14.595832 v -4.33422"
style="fill:none;fill-rule:evenodd;stroke:#4d4d4d;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
style="fill:none;fill-rule:evenodd;stroke:#4d4d4d;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 35.052979,100.03404 v -4.334217 h 14.595832 v 4.334217"
id="path5876"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccc" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:6.61458302px;font-family:Inconsolata;-inkscape-font-specification:Inconsolata;letter-spacing:0px;word-spacing:0px;fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="-0.80180889"
y="90.40065"
id="text5880"><tspan
sodipodi:role="line"
id="tspan5878"
x="-0.80180889"
y="90.40065"
style="fill:#4d4d4d;stroke-width:0.26458332px">owner</tspan></text>
<text
id="text5884"
y="123.2748"
x="15.768901"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:6.61458302px;font-family:Inconsolata;-inkscape-font-specification:Inconsolata;letter-spacing:0px;word-spacing:0px;fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
style="fill:#4d4d4d;stroke-width:0.26458332px"
y="123.2748"
x="15.768901"
id="tspan5882"
sodipodi:role="line">group</tspan></text>
<text
id="text5888"
y="90.322365"
x="29.915192"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:6.61458302px;font-family:Inconsolata;-inkscape-font-specification:Inconsolata;letter-spacing:0px;word-spacing:0px;fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
xml:space="preserve"><tspan
style="fill:#4d4d4d;stroke-width:0.26458332px"
y="90.322365"
x="29.915192"
id="tspan5886"
sodipodi:role="line">others</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:4.23333311px;font-family:Inconsolata;-inkscape-font-specification:Inconsolata;letter-spacing:0px;word-spacing:0px;fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="74.205276"
y="97.082382"
id="text5898"><tspan
sodipodi:role="line"
id="tspan5896"
x="74.205276"
y="97.082382"
style="line-height:4.23333311px;fill:#4d4d4d;stroke-width:0.26458332px">r: read</tspan><tspan
sodipodi:role="line"
x="74.205276"
y="101.31571"
style="line-height:4.23333311px;fill:#4d4d4d;stroke-width:0.26458332px"
id="tspan5906" /><tspan
sodipodi:role="line"
x="74.205276"
y="105.54905"
style="line-height:4.23333311px;fill:#4d4d4d;stroke-width:0.26458332px"
id="tspan5900">w: write</tspan><tspan
sodipodi:role="line"
x="74.205276"
y="109.78238"
style="line-height:4.23333311px;fill:#4d4d4d;stroke-width:0.26458332px"
id="tspan5908" /><tspan
sodipodi:role="line"
x="74.205276"
y="114.01572"
style="line-height:4.23333311px;fill:#4d4d4d;stroke-width:0.26458332px"
id="tspan5902">x: execute</tspan><tspan
sodipodi:role="line"
x="74.205276"
y="118.24905"
style="line-height:4.23333311px;fill:#4d4d4d;stroke-width:0.26458332px"
id="tspan5910" /><tspan
sodipodi:role="line"
x="74.205276"
y="122.48238"
style="line-height:4.23333311px;fill:#4d4d4d;stroke-width:0.26458332px"
id="tspan5904">-: not set</tspan></text>
</g>
</svg>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment