Skip to content

Commit

Permalink
DOC: render rotation matrix explicitly (#180)
Browse files Browse the repository at this point in the history
Co-authored-by: Mikhail Mikhasenko <[email protected]>
  • Loading branch information
redeboer and mmikhasenko authored Sep 21, 2022
1 parent 65afb7b commit eaf8c59
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/appendix.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
```{toctree}
appendix/dynamics
appendix/angles
appendix/rotation-matrix
appendix/phase-space
appendix/alignment
appendix/benchmark
Expand Down
83 changes: 83 additions & 0 deletions docs/appendix/rotation-matrix.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Explicit rotation matrix"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"```{autolink-concat}\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"import sympy as sp\n",
"\n",
"\n",
"def Rz(α):\n",
" return sp.Matrix(\n",
" [\n",
" [sp.cos(α), -sp.sin(α), 0],\n",
" [sp.sin(α), sp.cos(α), 0],\n",
" [0, 0, 1],\n",
" ]\n",
" )\n",
"\n",
"\n",
"def Ry(α):\n",
" return sp.Matrix(\n",
" [\n",
" [sp.cos(α), 0, sp.sin(α)],\n",
" [0, 1, 0],\n",
" [-sp.sin(α), 0, sp.cos(α)],\n",
" ]\n",
" )\n",
"\n",
"\n",
"θ, ϕ, χ = sp.symbols(\"theta phi chi\")\n",
"R = Rz(ϕ) @ Ry(θ) @ Rz(χ)\n",
"R"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.8.13"
},
"vscode": {
"interpreter": {
"hash": "d54b55e42db0e71aa222cee01fa24af6ccae1fbbd4d24a4dc92ca39f5243715f"
}
}
},
"nbformat": 4,
"nbformat_minor": 4
}

0 comments on commit eaf8c59

Please sign in to comment.