Created
August 15, 2014 18:12
-
-
Save arsenovic/98c6f00ef261ec0b29fa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:5d684f5c68331280ed850f18ea93218968a44f5fe55d19a679ae51c4a518c86f" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"collapsed": true, | |
"input": [ | |
"from GA.printer import Format\n", | |
"from GA.ga import Ga\n", | |
"from sympy import symbols,solve\n", | |
"Format(ipy=True)" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 2 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"ga,a ,b ,c = Ga.build('a b c')\n", | |
"alpha,beta = [ga.mv(k,'scalar') for k in ['alpha','beta']]" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 3 | |
}, | |
{ | |
"cell_type": "heading", | |
"level": 2, | |
"metadata": {}, | |
"source": [ | |
"Cramers rule" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": true, | |
"input": [ | |
"c = alpha*a+ beta*b\n", | |
"c" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"latex": [ | |
"\\begin{equation*} \\alpha \\boldsymbol{a} + \\beta \\boldsymbol{b} \\end{equation*}" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 4, | |
"text": [ | |
"<GA.mv.Mv at 0xe304910>" | |
] | |
} | |
], | |
"prompt_number": 4 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"(a^b).inv()*(c^b)" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"latex": [ | |
"\\begin{equation*} \\alpha \\end{equation*}" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 5, | |
"text": [ | |
"<GA.mv.Mv at 0xd0dbe50>" | |
] | |
} | |
], | |
"prompt_number": 5 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"(a^b).inv()*(a^c)" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"latex": [ | |
"\\begin{equation*} \\beta \\end{equation*}" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 6, | |
"text": [ | |
"<GA.mv.Mv at 0xe32b290>" | |
] | |
} | |
], | |
"prompt_number": 6 | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"\n", | |
" ** ?is it possible for this to work ? ** " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"# solve( alpha*a+ beta*b -c, alpha)" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 20 | |
}, | |
{ | |
"cell_type": "heading", | |
"level": 2, | |
"metadata": {}, | |
"source": [ | |
"\n", | |
"Comparison between Coordinate and Coordinate free expressions" | |
] | |
}, | |
{ | |
"cell_type": "heading", | |
"level": 3, | |
"metadata": {}, | |
"source": [ | |
"With A Basis" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Create a ga from an 3D orthonormal basis" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"(ga,e0,e1,e2) = Ga.build('e_0 e_1 e_2',g=[1,1,1])" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 8 | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"\n", | |
"Then, create three vectors in this ga, these are expressed in terms of the previously defined basis " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"a,b,c = [ga.mv(k,'vector') for k in ['a','b','c']]" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 9 | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"If we evaluate the following expression, it will be expanded in basis. " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"a|(b*c)" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"latex": [ | |
"\\begin{equation*} \\left ( - a^{1} b^{0} c^{1} + a^{1} b^{1} c^{0} - a^{2} b^{0} c^{2} + a^{2} b^{2} c^{0}\\right ) \\boldsymbol{e_{0}} + \\left ( a^{0} b^{0} c^{1} - a^{0} b^{1} c^{0} - a^{2} b^{1} c^{2} + a^{2} b^{2} c^{1}\\right ) \\boldsymbol{e_{1}} + \\left ( a^{0} b^{0} c^{2} - a^{0} b^{2} c^{0} + a^{1} b^{1} c^{2} - a^{1} b^{2} c^{1}\\right ) \\boldsymbol{e_{2}} \\end{equation*}" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 10, | |
"text": [ | |
"<GA.mv.Mv at 0xe32b1d0>" | |
] | |
} | |
], | |
"prompt_number": 10 | |
}, | |
{ | |
"cell_type": "heading", | |
"level": 3, | |
"metadata": {}, | |
"source": [ | |
"Without a Basis" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"If instead we simply define the geometric algebra with three arbitrary vectors" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"ga,a ,b ,c = Ga.build('a b c')" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 11 | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Now, if we evaluate the same expression, we see that it is simpler " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"(a|(b*c))" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"latex": [ | |
"\\begin{equation*} - \\left ( a\\cdot c\\right ) \\boldsymbol{b} + \\left ( a\\cdot b\\right ) \\boldsymbol{c} \\end{equation*}" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 12, | |
"text": [ | |
"<GA.mv.Mv at 0xe32b310>" | |
] | |
} | |
], | |
"prompt_number": 12 | |
}, | |
{ | |
"cell_type": "heading", | |
"level": 2, | |
"metadata": {}, | |
"source": [ | |
"Projetive Geometry" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Given a ga of n-dimensions (Gn), we can extend the algebra by one dimensions (Gn->Gn+1), and setup a projective map to relate them. " | |
] | |
}, | |
{ | |
"cell_type": "heading", | |
"level": 3, | |
"metadata": {}, | |
"source": [ | |
"Projective Plane" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"For the projective plane example we extend the plane by another dimension represented by the vector n, then we can define a map between the plane and 3d space through the up/down methods\n", | |
"\n", | |
"** ? can i implement projective/conformal geometry using a submanifold ?**\n", | |
"I would like also to map the projective split so i can re-use the same symbols. " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"(ga,e0,e1,n) = Ga.build('e_0 e_1 n',g=[1,1,1])\n", | |
"\n", | |
"\n", | |
"def down(a, n=n):\n", | |
" return n* ((n^a)*(n|a).inv())\n", | |
"\n", | |
"def up(a,n=n):\n", | |
" return n+a" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 13 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"a,b,c = [ga.mv(k,'vector') for k in ['a','b','c']]\n", | |
"\n", | |
"a = a.proj([e0,e1])\n", | |
"a" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"latex": [ | |
"\\begin{equation*} a^{0} \\boldsymbol{e_{0}} + a^{1} \\boldsymbol{e_{1}} \\end{equation*}" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 14, | |
"text": [ | |
"<GA.mv.Mv at 0xe4bbb50>" | |
] | |
} | |
], | |
"prompt_number": 14 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"# is it possible to get a sub algebra " | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [], | |
"prompt_number": 15 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"up(a)" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"latex": [ | |
"\\begin{equation*} a^{0} \\boldsymbol{e_{0}} + a^{1} \\boldsymbol{e_{1}} + \\boldsymbol{n} \\end{equation*}" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 16, | |
"text": [ | |
"<GA.mv.Mv at 0xe3fe790>" | |
] | |
} | |
], | |
"prompt_number": 16 | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Projecting the vector b 'down' it can be seen that we are using homogeneous coordinates" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"down(b)" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"latex": [ | |
"\\begin{equation*} \\frac{b^{0}}{b^{}} \\boldsymbol{e_{0}} + \\frac{b^{1}}{b^{}} \\boldsymbol{e_{1}} \\end{equation*}" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 17, | |
"text": [ | |
"<GA.mv.Mv at 0xe3fe290>" | |
] | |
} | |
], | |
"prompt_number": 17 | |
}, | |
{ | |
"cell_type": "code", | |
"collapsed": false, | |
"input": [ | |
"n*down(b)" | |
], | |
"language": "python", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"latex": [ | |
"\\begin{equation*} - \\frac{b^{0}}{b^{}} \\boldsymbol{e_{0}\\wedge n} - \\frac{b^{1}}{b^{}} \\boldsymbol{e_{1}\\wedge n} \\end{equation*}" | |
], | |
"metadata": {}, | |
"output_type": "pyout", | |
"prompt_number": 18, | |
"text": [ | |
"<GA.mv.Mv at 0xe4bb190>" | |
] | |
} | |
], | |
"prompt_number": 18 | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [] | |
} | |
], | |
"metadata": {} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment