Skip to content

LA: scalars, vectors, dot product, bases #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
20 changes: 19 additions & 1 deletion _data/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
- url: /data_work/stats
- url: /data_work/optimisation
- url: /data_work/ir_spectra
- url: /data_work/linear_algebra

- url: /advanced/advanced
not_numbered: false
Expand All @@ -69,5 +68,24 @@
- url: /advanced/classes
- url: /advanced/custom_packages

- url: /linear_algebra/linear_algebra
not_numbered: false
expand_sections: false
sections:
- url: /linear_algebra/scalars_and_vectors
- url: /linear_algebra/dot_product
- url: /linear_algebra/bases
- url: /linear_algebra/matrices
- url: /linear_algebra/determinants
- url: /linear_algebra/cross_product
- url: /linear_algebra/inverse_transformations
- url: /linear_algebra/active_passive_transformations
- url: /linear_algebra/diagonalisation
- url: /linear_algebra/eigenvectors_and_eigenfunctions
- url: /linear_algebra/change_of_variables
- url: /linear_algebra/notation
- url: /linear_algebra/problems




Binary file added content/images/additive_vectors.pdf
Binary file not shown.
Binary file added content/images/bases.pdf
Binary file not shown.
Binary file added content/images/bases_general.pdf
Binary file not shown.
Binary file added content/images/circle_road.pdf
Binary file not shown.
Binary file added content/images/ij.pdf
Binary file not shown.
Binary file added content/images/matrix_multiplication_1.pdf
Binary file not shown.
Binary file added content/images/matrix_multiplication_2.pdf
Binary file not shown.
Binary file added content/images/road_config.pdf
Binary file not shown.
Binary file added content/images/sphere.pdf
Binary file not shown.
Binary file added content/images/theta.pdf
Binary file not shown.
39 changes: 39 additions & 0 deletions content/linear_algebra/active_passive_transformations.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Active and passive transformations"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
124 changes: 124 additions & 0 deletions content/linear_algebra/bases.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Prerequisites:**\n",
"- Functions\n",
"- Collections\n",
"- NumPy arrays\n",
"- Scalars and vectors"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Bases\n",
"\n",
"Until now we have been representing vectors as linear combinations of $\\mathbf{i}$, $\\mathbf{j}$, and $\\mathbf{k}$. For example, we have shown the point $\\mathbf{p}$ = [2,4,3] can be written as\n",
"\n",
"$$ \\mathbf{p} = 2 \\mathbf{i} + 4 \\mathbf{j} + 3 \\mathbf{k}. $$\n",
"\n",
"In the above, we are using the standard basis. A basis is a set of vectors that describes the space that we are interested in. Any point within the domain that we are interested, in linear algebra this domain is called a linear subspace, can be described by a linear combination of our basis set. Consider three dimensional space, any point, $\\mathbf{r}$, can be described by a set of coordinates (x,y,z) and thus can be described by \n",
"\n",
"$$ \\mathbf{r} = x \\mathbf{i} + y \\mathbf{j} + z \\mathbf{k} .$$ \n",
"\n",
"Any point in three-dimensional space can be describe as such using the standard basis. The standard basis in three-dimensional space is defined as \n",
"\n",
"$$ \\mathbf{e_{x}} = \\mathbf{i} = \\begin{pmatrix} 1 \\\\ 0 \\\\ 0 \\end{pmatrix}, \\quad \\mathbf{e_{y}} = \\mathbf{j} = \\begin{pmatrix} 0 \\\\ 1 \\\\ 0 \\end{pmatrix}, \\quad \\mathbf{e_{z}} = \\mathbf{k} = \\begin{pmatrix} 0 \\\\ 0 \\\\ 1 \\end{pmatrix}. $$\n",
"\n",
"Explicitly, when we express $\\mathbf{r}$ as above we are writing\n",
"\n",
"$$ \\mathbf{r} = x \\begin{pmatrix} 1 \\\\ 0 \\\\ 0 \\end{pmatrix} + y \\begin{pmatrix} 0 \\\\ 1 \\\\ 0 \\end{pmatrix} + z \\begin{pmatrix} 0 \\\\ 0 \\\\ 1 \\end{pmatrix} = \\begin{pmatrix} x \\\\ 0 \\\\ 0 \\end{pmatrix} + \\begin{pmatrix} 0 \\\\ y \\\\ 0 \\end{pmatrix} + \\begin{pmatrix} 0 \\\\ 0 \\\\ z \\end{pmatrix} = \\begin{pmatrix} x \\\\ y \\\\ z \\end{pmatrix}. $$\n",
"\n",
"The standard basis is the most commonly used basis set because it is easy to picture mentally and convenient to use. However, it is not the only basis set that we could use, and sometimes it is not practical to use the standard basis set. \n",
"\n",
"We choose different bases sets all the time. Consider an experiment where we track the displacement of a particle throughout time. If we define the origin as the initial position of the particle, and use standard units then after a short time, t, the displacement of the particle is:\n",
"\n",
"$$ \\mathbf{r}(t) = \\begin{pmatrix} 1.2 \\times 10^{-7} \\\\ 2.8 \\times 10^{-6} \\\\ 3.3 \\times 10^{-7} \\end{pmatrix} \\; (/m)$$\n",
"\n",
"The reason for the small values is because our basis is in meters. If we change our basis so that it is in micrometers then we would obtain more manageable values. \n",
"\n",
"$$ \\mathbf{r}(t) = \\begin{pmatrix} 0.12 \\\\ 2.8 \\\\ 0.33 \\end{pmatrix} \\;(/\\mu m)$$\n",
"\n",
"Changing units can be considered as merely a change of basis vectors. Whilst, a change of units is a simple example of a change of basis, there is no reason why we cannot use any basis that we choose, as long as the basis set can sufficiently describe our system. \n",
"\n",
"A basis set must consist of linearly independant vectors. For a set of vectors to be linearly independant, each vector in the set cannot be written as a linear combination of the remaining vectors in the set. Let's clarify this using the standard basis set. We cannot write the vector $\\mathbf{i}$ in the form:\n",
"\n",
"$$\\mathbf{i} \\neq a \\mathbf{j} + b \\mathbf{k} \\quad \\forall a,b \\in \\mathbb{R}$$\n",
"\n",
"$$\\begin{pmatrix} 1 \\\\ 0 \\\\ 0 \\end{pmatrix} \\neq a \\begin{pmatrix} 0 \\\\ 1 \\\\ 0 \\end{pmatrix} + b \\begin{pmatrix} 0 \\\\ 0 \\\\ 1 \\end{pmatrix} \\quad \\forall a,b \\in \\mathbb{R}$$\n",
"\n",
"Where \"$\\forall a,b \\in \\mathbb{R}$\" means \"for all a,b in the real numbers\". No matter what values a and b take, the right and left hand sides of the equation will never equate. Therefore, the standard basis is a linearly independant basis set. Whereas if we wish to determine whether or not the set of vectors $\\mathbf{i}$, $\\mathbf{j}$, $\\mathbf{k}$, and $\\mathbf{p}$ is a linearly independant basis set, it is clearly not because we can write \n",
"\n",
"$$ \\mathbf{p} = 2 \\mathbf{i} + 4 \\mathbf{j} + 3 \\mathbf{k}. $$\n",
"\n",
"How about the set of vectors $\\mathbf{i}$, $\\mathbf{j}$, and $\\mathbf{p}$. Let's consider the combinations:\n",
"\n",
"$$\\begin{pmatrix} 1 \\\\ 0 \\\\ 0 \\end{pmatrix} \\neq a \\begin{pmatrix} 0 \\\\ 1 \\\\ 0 \\end{pmatrix} + b \\begin{pmatrix} 2 \\\\ 4 \\\\ 3 \\end{pmatrix} \\quad \\forall a,b \\in \\mathbb{R}$$\n",
"\n",
"$$\\begin{pmatrix} 0 \\\\ 1 \\\\ 0 \\end{pmatrix} \\neq a \\begin{pmatrix} 1 \\\\ 0 \\\\ 0 \\end{pmatrix} + b \\begin{pmatrix} 0 \\\\ 0 \\\\ 1 \\end{pmatrix} \\quad \\forall a,b \\in \\mathbb{R}$$\n",
"\n",
"$$\\begin{pmatrix} 2 \\\\ 4 \\\\ 3 \\end{pmatrix} \\neq a \\begin{pmatrix} 1 \\\\ 0 \\\\ 0 \\end{pmatrix} + b \\begin{pmatrix} 0 \\\\ 1 \\\\ 0 \\end{pmatrix} \\quad \\forall a,b \\in \\mathbb{R}$$\n",
"\n",
"Therefore, the set $\\mathbf{i}$, $\\mathbf{j}$, $\\mathbf{p}$ is a valid basis set to describe three dimensional space. In order to visualise what a linear subspace looks like using a basis set that is not the standard basis set, consider a linear subspace defined by the basis set \n",
"\n",
"$$ \\begin{pmatrix} 2 \\\\ 0 \\\\ 0 \\end{pmatrix}, \\; \\begin{pmatrix} 0 \\\\ 1 \\\\ 0 \\end{pmatrix}, \\; \\begin{pmatrix} 0 \\\\ 0 \\\\ 1 \\end{pmatrix} $$\n",
"\n",
"The only difference is that the x direction basis vector has double the length. The linear subspace, and the three bases vectors can be visualised below. \n",
"\n",
"<img src=\"../images/bases.pdf\" alt=\"drawing\" width=\"600\"/>\n",
"\n",
"Note that the grid lines along the x-axis are more seperated than along the y and z axes. Under this new basis set, the point (1,1,1), under the standard basis set, has coordinates (0.5, 1, 1) under this new basis set because (0.5, 1, 1) is equivalent to\n",
"\n",
"$$ 0.5 \\begin{pmatrix} 2 \\\\ 0 \\\\ 0 \\end{pmatrix} + 1 \\begin{pmatrix} 0 \\\\ 1 \\\\ 0 \\end{pmatrix} + 1 \\begin{pmatrix} 0 \\\\ 0 \\\\ 1 \\end{pmatrix}. $$\n",
"\n",
"**Exercise:** Determine the vector associated with the point (17, 2, -9) using the basis set described above."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"ExecuteTime": {
"end_time": "2020-06-15T17:22:19.971522Z",
"start_time": "2020-06-15T17:22:19.968034Z"
}
},
"outputs": [],
"source": [
"### Write your code here"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
39 changes: 39 additions & 0 deletions content/linear_algebra/change_of_variables.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Change of variables"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Linear algebra"
"## Cross product"
]
},
{
Expand Down Expand Up @@ -35,5 +35,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 4
"nbformat_minor": 2
}
39 changes: 39 additions & 0 deletions content/linear_algebra/determinants.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Determinants"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
39 changes: 39 additions & 0 deletions content/linear_algebra/diagonalisation.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Diagonalisation"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading