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

Adding Linear Algebra workbook #267

Merged
merged 19 commits into from
Jan 19, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Do a round of cleanup
Also fix testing harness for task 1 and make tests for task 14 stronger
  • Loading branch information
tcNickolas committed Jan 19, 2020
commit adf9497e58c3c2ba4e6c892c6c9ecd10843174f2
24 changes: 12 additions & 12 deletions tutorials/ComplexArithmetic/Workbook_ComplexArithmetic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"[Return to task 1 of the Complex Arithmetic kata.](./ComplexArithmetic.ipynb#Exercise-1:-Powers-of-$i$.)"
"[Return to task 1 of the Complex Arithmetic tutorial.](./ComplexArithmetic.ipynb#Exercise-1:-Powers-of-$i$.)"
]
},
{
Expand Down Expand Up @@ -156,7 +156,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"[Return to task 2 of the Complex Arithmetic kata.](./ComplexArithmetic.ipynb#Exercise-2:-Complex-addition.)"
"[Return to task 2 of the Complex Arithmetic tutorial.](./ComplexArithmetic.ipynb#Exercise-2:-Complex-addition.)"
]
},
{
Expand Down Expand Up @@ -209,7 +209,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"[Return to task 3 of the Complex Arithmetic kata.](./ComplexArithmetic.ipynb#Exercise-3:-Complex-multiplication.)"
"[Return to task 3 of the Complex Arithmetic tutorial.](./ComplexArithmetic.ipynb#Exercise-3:-Complex-multiplication.)"
]
},
{
Expand Down Expand Up @@ -256,7 +256,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"[Return to task 4 of the Complex Arithmetic kata.](./ComplexArithmetic.ipynb#Exercise-4:-Complex-conjugate.)"
"[Return to task 4 of the Complex Arithmetic tutorial.](./ComplexArithmetic.ipynb#Exercise-4:-Complex-conjugate.)"
]
},
{
Expand Down Expand Up @@ -317,7 +317,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"[Return to task 5 of the Complex Arithmetic kata.](./ComplexArithmetic.ipynb#Exercise-5:-Complex-division.)"
"[Return to task 5 of the Complex Arithmetic tutorial.](./ComplexArithmetic.ipynb#Exercise-5:-Complex-division.)"
]
},
{
Expand Down Expand Up @@ -367,7 +367,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"[Return to task 6 of the Complex Arithmetic kata.](./ComplexArithmetic.ipynb#Exercise-6:-Modulus.)"
"[Return to task 6 of the Complex Arithmetic tutorial.](./ComplexArithmetic.ipynb#Exercise-6:-Modulus.)"
]
},
{
Expand Down Expand Up @@ -419,7 +419,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"[Return to task 7 of the Complex Arithmetic kata.](./ComplexArithmetic.ipynb#Exercise-7:-Complex-exponents.)"
"[Return to task 7 of the Complex Arithmetic tutorial.](./ComplexArithmetic.ipynb#Exercise-7:-Complex-exponents.)"
]
},
{
Expand Down Expand Up @@ -493,7 +493,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"[Return to task 8 of the Complex Arithmetic kata.](./ComplexArithmetic.ipynb#Exercise-8*:-Complex-powers-of-real-numbers.)"
"[Return to task 8 of the Complex Arithmetic tutorial.](./ComplexArithmetic.ipynb#Exercise-8*:-Complex-powers-of-real-numbers.)"
]
},
{
Expand Down Expand Up @@ -563,7 +563,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"[Return to task 9 of the Complex Arithmetic kata.](./ComplexArithmetic.ipynb#Exercise-9:-Cartesian-to-polar-conversion.)"
"[Return to task 9 of the Complex Arithmetic tutorial.](./ComplexArithmetic.ipynb#Exercise-9:-Cartesian-to-polar-conversion.)"
]
},
{
Expand Down Expand Up @@ -609,7 +609,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"[Return to task 10 of the Complex Arithmetic kata.](./ComplexArithmetic.ipynb#Exercise-10:-Polar-to-Cartesian-conversion.)"
"[Return to task 10 of the Complex Arithmetic tutorial.](./ComplexArithmetic.ipynb#Exercise-10:-Polar-to-Cartesian-conversion.)"
]
},
{
Expand Down Expand Up @@ -686,7 +686,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"[Return to task 11 of the Complex Arithmetic kata.](./ComplexArithmetic.ipynb#Exercise-11:-Polar-multiplication.)"
"[Return to task 11 of the Complex Arithmetic tutorial.](./ComplexArithmetic.ipynb#Exercise-11:-Polar-multiplication.)"
]
},
{
Expand Down Expand Up @@ -754,7 +754,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"[Return to task 12 of the Complex Arithmetic kata.](./ComplexArithmetic.ipynb#Exercise-12**:-Arbitrary-complex-exponents.)"
"[Return to task 12 of the Complex Arithmetic tutorial.](./ComplexArithmetic.ipynb#Exercise-12**:-Arbitrary-complex-exponents.)"
]
}
],
Expand Down
23 changes: 14 additions & 9 deletions tutorials/LinearAlgebra/LinearAlgebra.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -178,17 +178,17 @@
"@exercise\n",
"def matrix_add(a : Matrix, b : Matrix) -> Matrix:\n",
" # You can get the size of a matrix like this:\n",
" n = len(a)\n",
" m = len(a[0])\n",
" rows = len(a)\n",
" columns = len(a[0])\n",
" \n",
" # You can use the following function to initialize an n×m matrix filled with 0s to store your answer\n",
" c = create_empty_matrix(n, m)\n",
" # You can use the following function to initialize a rows×columns matrix filled with 0s to store your answer\n",
" c = create_empty_matrix(rows, columns)\n",
" \n",
" # You can use a for loop to execute its body several times;\n",
" # in this loop variable i will take on each value from 0 to n-1, inclusive\n",
" for i in range(n):\n",
" for i in range(rows):\n",
" # Loops can be nested\n",
" for j in range(m):\n",
" for j in range(columns):\n",
" # You can access elements of a matrix like this:\n",
" x = a[i][j]\n",
" y = b[i][j]\n",
Expand Down Expand Up @@ -766,8 +766,13 @@
" 3 \\\\\n",
" -8\n",
"\\end{bmatrix}\n",
"= (-6) \\cdot (3) + (-9i) \\cdot (-8) = -18 + 72i$$\n",
"\n",
"= (-6) \\cdot (3) + (-9i) \\cdot (-8) = -18 + 72i$$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"If you are familiar with the **dot product**, you will notice that it is equivalent to inner product for real-numbered vectors.\n",
"\n",
"> We use our definition for these tutorials because it matches the notation used in quantum computing. You might encounter other sources which define the inner product a little differently: $\\langle V , W \\rangle = W^\\dagger V = V^T\\overline{W}$, in contrast to the $V^\\dagger W$ that we use. These definitions are almost equivalent, with some differences in the scalar multiplication by a complex number.\n",
Expand Down Expand Up @@ -1084,7 +1089,7 @@
"<br/>\n",
"<details>\n",
" <summary><strong>Need a hint? Click here</strong></summary>\n",
" Multiply the matrix by the vector, then divide elements of the result by elements of the original vector. Don't forget though, some elements of the vector may be $0$.\n",
" Multiply the matrix by the vector, then divide the elements of the result by the elements of the original vector. Don't forget though, some elements of the vector may be $0$.\n",
"</details>"
]
},
Expand Down
Loading