Skip to content
This repository was archived by the owner on Aug 21, 2024. It is now read-only.

Commit 02916ea

Browse files
authored
Fix math mode rendering in GitHub preview, part 1 (#814)
Per the discussion in #809, fix the first batch of tutorials and workbooks, up to the MultiQubitGates tutorial.
1 parent 97b4b5b commit 02916ea

File tree

7 files changed

+131
-125
lines changed

7 files changed

+131
-125
lines changed

BasicGates/BasicGates.ipynb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@
214214
"\n",
215215
"**Input:** A qubit in state $|\\psi\\rangle = \\alpha |0\\rangle + \\beta |1\\rangle$.\n",
216216
"\n",
217-
"**Goal:** Change the qubit state to $\\alpha |0\\rangle + \\color{red}i\\beta |1\\rangle$ (add a relative phase $i$ to $|1\\rangle$ component of the superposition).\n"
217+
"**Goal:** Change the qubit state to $\\alpha |0\\rangle + {\\color{red}i}\\beta |1\\rangle$ (add a relative phase $i$ to $|1\\rangle$ component of the superposition).\n"
218218
]
219219
},
220220
{
@@ -251,7 +251,7 @@
251251
"**Goal:** Change the state of the qubit as follows:\n",
252252
"- If the qubit is in state $|0\\rangle$, don't change its state.\n",
253253
"- If the qubit is in state $|1\\rangle$, change its state to $e^{i\\alpha} |1\\rangle$.\n",
254-
"- If the qubit is in superposition, change its state according to the effect on basis vectors: $\\beta |0\\rangle + \\color{red}{e^{i\\alpha}} \\gamma |1\\rangle$.\n"
254+
"- If the qubit is in superposition, change its state according to the effect on basis vectors: $\\beta |0\\rangle + {\\color{red}{e^{i\\alpha}}} \\gamma |1\\rangle$.\n"
255255
]
256256
},
257257
{
@@ -479,10 +479,10 @@
479479
"source": [
480480
"### Task 2.2. Two-qubit gate - 2\n",
481481
"\n",
482-
"**Input:** Two unentangled qubits (stored in an array of length 2) in state $|+\\rangle \\otimes |+\\rangle = \\frac{1}{2} \\big( |00\\rangle + |01\\rangle + |10\\rangle \\color{blue}+ |11\\rangle \\big)$.\n",
482+
"**Input:** Two unentangled qubits (stored in an array of length 2) in state $|+\\rangle \\otimes |+\\rangle = \\frac{1}{2} \\big( |00\\rangle + |01\\rangle + |10\\rangle {\\color{blue}+} |11\\rangle \\big)$.\n",
483483
"\n",
484484
"\n",
485-
"**Goal:** Change the two-qubit state to $\\frac{1}{2} \\big( |00\\rangle + |01\\rangle + |10\\rangle \\color{red}- |11\\rangle \\big)$.\n",
485+
"**Goal:** Change the two-qubit state to $\\frac{1}{2} \\big( |00\\rangle + |01\\rangle + |10\\rangle {\\color{red}-} |11\\rangle \\big)$.\n",
486486
"\n",
487487
"> Note that while the starting state can be represented as a tensor product of single-qubit states,\n",
488488
"> the resulting two-qubit state can not be represented in such a way."
@@ -514,10 +514,10 @@
514514
"source": [
515515
"### Task 2.3. Two-qubit gate - 3\n",
516516
"\n",
517-
"**Input:** Two unentangled qubits (stored in an array of length 2) in an arbitrary two-qubit state $\\alpha |00\\rangle + \\color{blue}\\beta |01\\rangle + \\color{blue}\\gamma |10\\rangle + \\delta |11\\rangle$.\n",
517+
"**Input:** Two unentangled qubits (stored in an array of length 2) in an arbitrary two-qubit state $\\alpha |00\\rangle + {\\color{blue}\\beta} |01\\rangle + {\\color{blue}\\gamma} |10\\rangle + \\delta |11\\rangle$.\n",
518518
"\n",
519519
"\n",
520-
"**Goal:** Change the two-qubit state to $\\alpha |00\\rangle + \\color{red}\\gamma |01\\rangle + \\color{red}\\beta |10\\rangle + \\delta |11\\rangle$.\n",
520+
"**Goal:** Change the two-qubit state to $\\alpha |00\\rangle + {\\color{red}\\gamma} |01\\rangle + {\\color{red}\\beta} |10\\rangle + \\delta |11\\rangle$.\n",
521521
"\n",
522522
"> This task can be solved using one intrinsic gate; as an exercise, try to express the solution using several (possibly controlled) Pauli gates."
523523
]
@@ -549,9 +549,9 @@
549549
"### Task 2.4. Toffoli gate\n",
550550
"\n",
551551
"**Input:** Three qubits (stored in an array of length 3) in an arbitrary three-qubit state \n",
552-
"$\\alpha |000\\rangle + \\beta |001\\rangle + \\gamma |010\\rangle + \\delta |011\\rangle + \\epsilon |100\\rangle + \\zeta|101\\rangle + \\color{blue}\\eta|110\\rangle + \\color{blue}\\theta|111\\rangle$.\n",
552+
"$\\alpha |000\\rangle + \\beta |001\\rangle + \\gamma |010\\rangle + \\delta |011\\rangle + \\epsilon |100\\rangle + \\zeta|101\\rangle + {\\color{blue}\\eta}|110\\rangle + {\\color{blue}\\theta}|111\\rangle$.\n",
553553
"\n",
554-
"**Goal:** Flip the state of the third qubit if the state of the first two is $|11\\rangle$, i.e., change the three-qubit state to $\\alpha |000\\rangle + \\beta |001\\rangle + \\gamma |010\\rangle + \\delta |011\\rangle + \\epsilon |100\\rangle + \\zeta|101\\rangle + \\color{red}\\theta|110\\rangle + \\color{red}\\eta|111\\rangle$."
554+
"**Goal:** Flip the state of the third qubit if the state of the first two is $|11\\rangle$, i.e., change the three-qubit state to $\\alpha |000\\rangle + \\beta |001\\rangle + \\gamma |010\\rangle + \\delta |011\\rangle + \\epsilon |100\\rangle + \\zeta|101\\rangle + {\\color{red}\\theta}|110\\rangle + {\\color{red}\\eta}|111\\rangle$."
555555
]
556556
},
557557
{
@@ -581,9 +581,9 @@
581581
"### Task 2.5. Fredkin gate\n",
582582
"\n",
583583
"**Input:** Three qubits (stored in an array of length 3) in an arbitrary three-qubit state \n",
584-
"$\\alpha |000\\rangle + \\beta |001\\rangle + \\gamma |010\\rangle + \\delta |011\\rangle + \\epsilon |100\\rangle + \\color{blue}\\zeta|101\\rangle + \\color{blue}\\eta|110\\rangle + \\theta|111\\rangle$.\n",
584+
"$\\alpha |000\\rangle + \\beta |001\\rangle + \\gamma |010\\rangle + \\delta |011\\rangle + \\epsilon |100\\rangle + {\\color{blue}\\zeta}|101\\rangle + {\\color{blue}\\eta}|110\\rangle + \\theta|111\\rangle$.\n",
585585
"\n",
586-
"**Goal:** Swap the states of second and third qubit if and only if the state of the first qubit is $|1\\rangle$, i.e., change the three-qubit state to $\\alpha |000\\rangle + \\beta |001\\rangle + \\gamma |010\\rangle + \\delta |011\\rangle + \\epsilon |100\\rangle + \\color{red}\\eta|101\\rangle + \\color{red}\\zeta|110\\rangle + \\theta|111\\rangle$."
586+
"**Goal:** Swap the states of second and third qubit if and only if the state of the first qubit is $|1\\rangle$, i.e., change the three-qubit state to $\\alpha |000\\rangle + \\beta |001\\rangle + \\gamma |010\\rangle + \\delta |011\\rangle + \\epsilon |100\\rangle + {\\color{red}\\eta}|101\\rangle + {\\color{red}\\zeta}|110\\rangle + \\theta|111\\rangle$."
587587
]
588588
},
589589
{

BasicGates/Workbook_BasicGates.ipynb

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@
622622
"\n",
623623
"**Input:** A qubit in state $|\\psi\\rangle = \\alpha |0\\rangle + \\beta |1\\rangle$.\n",
624624
"\n",
625-
"**Goal:** Change the qubit state to $\\alpha |0\\rangle + \\color{red}i\\beta |1\\rangle$ (add a relative phase $i$ to $|1\\rangle$ component of the superposition).\n"
625+
"**Goal:** Change the qubit state to $\\alpha |0\\rangle + {\\color{red}i}\\beta |1\\rangle$ (add a relative phase $i$ to $|1\\rangle$ component of the superposition).\n"
626626
]
627627
},
628628
{
@@ -745,7 +745,7 @@
745745
"**Goal:** Change the state of the qubit as follows:\n",
746746
"- If the qubit is in state $|0\\rangle$, don't change its state.\n",
747747
"- If the qubit is in state $|1\\rangle$, change its state to $e^{i\\alpha} |1\\rangle$.\n",
748-
"- If the qubit is in superposition, change its state according to the effect on basis vectors: $\\beta |0\\rangle + \\color{red}{e^{i\\alpha}} \\gamma |1\\rangle$."
748+
"- If the qubit is in superposition, change its state according to the effect on basis vectors: $\\beta |0\\rangle + {\\color{red}{e^{i\\alpha}}} \\gamma |1\\rangle$."
749749
]
750750
},
751751
{
@@ -794,14 +794,14 @@
794794
" =\n",
795795
"\\begin{bmatrix}\n",
796796
" 1.\\beta + 0.\\gamma\\\\\n",
797-
" 0.\\beta + \\color{red}{e^{i\\alpha}}\\gamma\n",
797+
" 0.\\beta + {\\color{red}{e^{i\\alpha}}}\\gamma\n",
798798
" \\end{bmatrix} \n",
799799
" =\n",
800800
" \\begin{bmatrix}\n",
801801
" \\beta\\\\\n",
802-
" \\color{red}{e^{i\\alpha}}\\gamma\n",
802+
" {\\color{red}{e^{i\\alpha}}}\\gamma\n",
803803
" \\end{bmatrix} \n",
804-
" = \\beta |0\\rangle + \\color{red}{e^{i\\alpha}} \\gamma |1\\rangle\n",
804+
" = \\beta |0\\rangle + {\\color{red}{e^{i\\alpha}}} \\gamma |1\\rangle\n",
805805
"$$"
806806
]
807807
},
@@ -1166,10 +1166,10 @@
11661166
"source": [
11671167
"## Task 2.2. Two-qubit gate - 2\n",
11681168
"\n",
1169-
"**Input:** Two unentangled qubits (stored in an array of length 2) in state $|+\\rangle \\otimes |+\\rangle = \\frac{1}{2} \\big( |00\\rangle + |01\\rangle + |10\\rangle \\color{blue}+ |11\\rangle \\big)$.\n",
1169+
"**Input:** Two unentangled qubits (stored in an array of length 2) in state $|+\\rangle \\otimes |+\\rangle = \\frac{1}{2} \\big( |00\\rangle + |01\\rangle + |10\\rangle {\\color{blue}+} |11\\rangle \\big)$.\n",
11701170
"\n",
11711171
"\n",
1172-
"**Goal:** Change the two-qubit state to $\\frac{1}{2} \\big( |00\\rangle + |01\\rangle + |10\\rangle \\color{red}- |11\\rangle \\big)$."
1172+
"**Goal:** Change the two-qubit state to $\\frac{1}{2} \\big( |00\\rangle + |01\\rangle + |10\\rangle {\\color{red}-} |11\\rangle \\big)$."
11731173
]
11741174
},
11751175
{
@@ -1278,7 +1278,7 @@
12781278
" 1\\cdot\\color{red}{e^{i\\alpha}}\\\\\n",
12791279
"\\end{bmatrix}\n",
12801280
"=\n",
1281-
"\\frac{1}{2} \\big( |00\\rangle + |01\\rangle + |10\\rangle \\color{red}- |11\\rangle \\big)\n",
1281+
"\\frac{1}{2} \\big( |00\\rangle + |01\\rangle + |10\\rangle {\\color{red}-} |11\\rangle \\big)\n",
12821282
"$$"
12831283
]
12841284
},
@@ -1337,10 +1337,10 @@
13371337
"source": [
13381338
"## Task 2.3. Two-qubit gate - 3\n",
13391339
"\n",
1340-
"**Input:** Two unentangled qubits (stored in an array of length 2) in an arbitrary two-qubit state $\\alpha |00\\rangle + \\color{blue}\\beta |01\\rangle + \\color{blue}\\gamma |10\\rangle + \\delta |11\\rangle$.\n",
1340+
"**Input:** Two unentangled qubits (stored in an array of length 2) in an arbitrary two-qubit state $\\alpha |00\\rangle + {\\color{blue}\\beta} |01\\rangle + {\\color{blue}\\gamma} |10\\rangle + \\delta |11\\rangle$.\n",
13411341
"\n",
13421342
"\n",
1343-
"**Goal:** Change the two-qubit state to $\\alpha |00\\rangle + \\color{red}\\gamma |01\\rangle + \\color{red}\\beta |10\\rangle + \\delta |11\\rangle$.\n",
1343+
"**Goal:** Change the two-qubit state to $\\alpha |00\\rangle + {\\color{red}\\gamma} |01\\rangle + {\\color{red}\\beta} |10\\rangle + \\delta |11\\rangle$.\n",
13441344
"\n",
13451345
"> This task can be solved using one intrinsic gate; as an exercise, try to express the solution using several (possibly controlled) Pauli gates."
13461346
]
@@ -1423,7 +1423,7 @@
14231423
" \\delta\\\\\n",
14241424
"\\end{bmatrix}\n",
14251425
"=\n",
1426-
"|00\\rangle + \\color{red}\\gamma |01\\rangle + \\color{red}\\beta |10\\rangle + \\delta |11\\rangle\n",
1426+
"|00\\rangle + {\\color{red}\\gamma} |01\\rangle + {\\color{red}\\beta} |10\\rangle + \\delta |11\\rangle\n",
14271427
"$$"
14281428
]
14291429
},
@@ -1533,9 +1533,9 @@
15331533
"## Task 2.4. Toffoli gate\n",
15341534
"\n",
15351535
"**Input:** Three qubits (stored in an array of length 3) in an arbitrary three-qubit state \n",
1536-
"$\\alpha |000\\rangle + \\beta |001\\rangle + \\gamma |010\\rangle + \\delta |011\\rangle + \\epsilon |100\\rangle + \\zeta|101\\rangle + \\color{blue}\\eta|110\\rangle + \\color{blue}\\theta|111\\rangle$.\n",
1536+
"$\\alpha |000\\rangle + \\beta |001\\rangle + \\gamma |010\\rangle + \\delta |011\\rangle + \\epsilon |100\\rangle + \\zeta|101\\rangle + {\\color{blue}\\eta}|110\\rangle + {\\color{blue}\\theta}|111\\rangle$.\n",
15371537
"\n",
1538-
"**Goal:** Flip the state of the third qubit if the state of the first two is $|11\\rangle$, i.e., change the three-qubit state to $\\alpha |000\\rangle + \\beta |001\\rangle + \\gamma |010\\rangle + \\delta |011\\rangle + \\epsilon |100\\rangle + \\zeta|101\\rangle + \\color{red}\\theta|110\\rangle + \\color{red}\\eta|111\\rangle$.\n",
1538+
"**Goal:** Flip the state of the third qubit if the state of the first two is $|11\\rangle$, i.e., change the three-qubit state to $\\alpha |000\\rangle + \\beta |001\\rangle + \\gamma |010\\rangle + \\delta |011\\rangle + \\epsilon |100\\rangle + \\zeta|101\\rangle + {\\color{red}\\theta}|110\\rangle + {\\color{red}\\eta}|111\\rangle$.\n",
15391539
"\n",
15401540
"### Solution\n",
15411541
"\n",
@@ -1629,7 +1629,7 @@
16291629
" \\color{red}\\eta\\\\ \n",
16301630
"\\end{bmatrix}\n",
16311631
"=\n",
1632-
"\\alpha |000\\rangle + \\beta |001\\rangle + \\gamma |010\\rangle + \\delta |011\\rangle + \\epsilon |100\\rangle + \\zeta|101\\rangle + \\color{red}\\theta|110\\rangle + \\color{red}\\eta|111\\rangle\n",
1632+
"\\alpha |000\\rangle + \\beta |001\\rangle + \\gamma |010\\rangle + \\delta |011\\rangle + \\epsilon |100\\rangle + \\zeta|101\\rangle + {\\color{red}\\theta}|110\\rangle + {\\color{red}\\eta}|111\\rangle\n",
16331633
"$$"
16341634
]
16351635
},
@@ -1660,9 +1660,9 @@
16601660
"## Task 2.5. Fredkin gate\n",
16611661
"\n",
16621662
"**Input:** Three qubits (stored in an array of length 3) in an arbitrary three-qubit state \n",
1663-
"$\\alpha |000\\rangle + \\beta |001\\rangle + \\gamma |010\\rangle + \\delta |011\\rangle + \\epsilon |100\\rangle + \\color{blue}\\zeta|101\\rangle + \\color{blue}\\eta|110\\rangle + \\theta|111\\rangle$.\n",
1663+
"$\\alpha |000\\rangle + \\beta |001\\rangle + \\gamma |010\\rangle + \\delta |011\\rangle + \\epsilon |100\\rangle + {\\color{blue}\\zeta}|101\\rangle + {\\color{blue}\\eta}|110\\rangle + \\theta|111\\rangle$.\n",
16641664
"\n",
1665-
"**Goal:** Swap the states of second and third qubit if and only if the state of the first qubit is $|1\\rangle$, i.e., change the three-qubit state to $\\alpha |000\\rangle + \\beta |001\\rangle + \\gamma |010\\rangle + \\delta |011\\rangle + \\epsilon |100\\rangle + \\color{red}\\eta|101\\rangle + \\color{red}\\zeta|110\\rangle + \\theta|111\\rangle$.\n",
1665+
"**Goal:** Swap the states of second and third qubit if and only if the state of the first qubit is $|1\\rangle$, i.e., change the three-qubit state to $\\alpha |000\\rangle + \\beta |001\\rangle + \\gamma |010\\rangle + \\delta |011\\rangle + \\epsilon |100\\rangle + {\\color{red}\\eta}|101\\rangle + {\\color{red}\\zeta}|110\\rangle + \\theta|111\\rangle$.\n",
16661666
"\n",
16671667
"\n",
16681668
"### Solution\n",
@@ -1758,7 +1758,7 @@
17581758
" \\theta\\\\ \n",
17591759
"\\end{bmatrix}\n",
17601760
"=\n",
1761-
"\\alpha |000\\rangle + \\beta |001\\rangle + \\gamma |010\\rangle + \\delta |011\\rangle + \\epsilon |100\\rangle + \\color{red}\\eta|101\\rangle + \\color{red}\\zeta|110\\rangle + \\theta|111\\rangle\n",
1761+
"\\alpha |000\\rangle + \\beta |001\\rangle + \\gamma |010\\rangle + \\delta |011\\rangle + \\epsilon |100\\rangle + {\\color{red}\\eta}|101\\rangle + {\\color{red}\\zeta}|110\\rangle + \\theta|111\\rangle\n",
17621762
"$$"
17631763
]
17641764
},
@@ -1800,7 +1800,7 @@
18001800
"file_extension": ".qs",
18011801
"mimetype": "text/x-qsharp",
18021802
"name": "qsharp",
1803-
"version": "0.14"
1803+
"version": "0.24"
18041804
},
18051805
"widgets": {
18061806
"application/vnd.jupyter.widget-state+json": {

tutorials/ComplexArithmetic/ComplexArithmetic.ipynb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@
6868
"\n",
6969
"As we said before, $i$ can't be a real number. In that case, we'll call it an **imaginary unit**. However, there is no reason for us to define it as acting any different from any other number, other than the fact that $i^2 = -1$:\n",
7070
"\n",
71-
"$$i + i = 2i \\\\\n",
72-
"i - i = 0 \\\\\n",
73-
"-1 \\cdot i = -i \\\\\n",
74-
"(-i)^{2} = -1$$\n",
71+
"$$i + i = 2i$$\n",
72+
"$$i - i = 0$$\n",
73+
"$$-1 \\cdot i = -i$$\n",
74+
"$$(-i)^{2} = -1$$\n",
7575
"\n",
7676
"We'll call the number $i$ and its real multiples **imaginary numbers**.\n",
7777
"\n",
@@ -251,8 +251,8 @@
251251
"\n",
252252
"Another property of the conjugate is that it distributes over both complex addition and complex multiplication:\n",
253253
"\n",
254-
"$$\\overline{x + y} = \\overline{x} + \\overline{y} \\\\\n",
255-
"\\overline{x \\cdot y} = \\overline{x} \\cdot \\overline{y}$$"
254+
"$$\\overline{x + y} = \\overline{x} + \\overline{y}$$\n",
255+
"$$\\overline{x \\cdot y} = \\overline{x} \\cdot \\overline{y}$$"
256256
]
257257
},
258258
{

tutorials/LinearAlgebra/LinearAlgebra.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,8 @@
405405
"\n",
406406
"Another, equivalent definition highlights what makes this an interesting property. For any matrices $B$ and $C$ of compatible sizes:\n",
407407
"\n",
408-
"$$A^{-1}(AB) = A(A^{-1}B) = B \\\\\n",
409-
"(CA)A^{-1} = (CA^{-1})A = C$$\n",
408+
"$$A^{-1}(AB) = A(A^{-1}B) = B$$\n",
409+
"$$(CA)A^{-1} = (CA^{-1})A = C$$\n",
410410
"\n",
411411
"A square matrix has a property called the **determinant**, with the determinant of matrix $A$ being written as $|A|$. A matrix is invertible if and only if its determinant isn't equal to $0$.\n",
412412
"\n",
@@ -948,8 +948,8 @@
948948
" A_{n-1,0} \\cdot \\color{blue} {\\begin{bmatrix}B_{0,0} & \\dotsb & B_{0,l-1} \\\\ \\vdots & \\ddots & \\vdots \\\\ B_{k-1,0} & \\dotsb & B_{k-1,l-1} \\end{bmatrix}} & \\dotsb &\n",
949949
" A_{n-1,m-1} \\cdot \\color{red} {\\begin{bmatrix}B_{0,0} & \\dotsb & B_{0,l-1} \\\\ \\vdots & \\ddots & \\vdots \\\\ B_{k-1,0} & \\dotsb & B_{k-1,l-1} \\end{bmatrix}}\n",
950950
"\\end{bmatrix}\n",
951-
"= \\\\\n",
952-
"=\n",
951+
"=$$\n",
952+
"$$=\n",
953953
"\\begin{bmatrix}\n",
954954
" A_{0,0} \\cdot \\color{red} {B_{0,0}} & \\dotsb & A_{0,0} \\cdot \\color{red} {B_{0,l-1}} & \\dotsb & A_{0,m-1} \\cdot \\color{blue} {B_{0,0}} & \\dotsb & A_{0,m-1} \\cdot \\color{blue} {B_{0,l-1}} \\\\\n",
955955
" \\vdots & \\ddots & \\vdots & \\dotsb & \\vdots & \\ddots & \\vdots \\\\\n",

0 commit comments

Comments
 (0)