Skip to content

Instantly share code, notes, and snippets.

@arsenovic
Created January 31, 2021 13:40
Show Gist options
  • Save arsenovic/aca84f12e76b77fa9fbceb556da681b2 to your computer and use it in GitHub Desktop.
Save arsenovic/aca84f12e76b77fa9fbceb556da681b2 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"id": "seventh-witch",
"metadata": {},
"source": [
"### Spinors for Symmetric matrix , 2D for starters"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "decreased-world",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[(2.0^e1), (6.0^e2)]"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\n",
"from pylab import * \n",
"from clifford import Cl\n",
"\n",
"l,b = Cl(sig=[-1,1,1],firstIdx=0)\n",
"locals().update(b)\n",
"\n",
"up = lambda x: x + abs(x)*e0\n",
"dn = lambda X: (X^e0)/e0\n",
" \n",
"x = l.randomV()(e12)\n",
"assert(dn(up(x))==x)\n",
"\n",
"d = 2 # size of smallest eigenval\n",
"r = 3 # ratio of eigenval 1 to eigenval2\n",
"\n",
"\n",
"B = up(e1)^up(e2) # plane of rotation, squeeze map between e1,e2\n",
"D = sqrt(d)*sqrt(sqrt(r))*e**(log(sqrt(r))/2*B) # the spinor\n",
"\n",
"Y = [dn(D*up(x)*~D) for x in [e1,e2]]\n",
"Y"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "going-approach",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[2., 0.],\n",
" [0., 6.]])"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Convert to a matrix \n",
"X = e12.basis()\n",
"y = array([float(x|y) for x in X for y in Y]).reshape(2,2)\n",
"y"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "prepared-living",
"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"
},
"toc": {
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"toc_cell": false,
"toc_position": {},
"toc_section_display": "block",
"toc_window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment