This notebook verifies doc/python/*.py
In [1]:
import sympy
In [2]:
from __future__ import absolute_import, division
from __future__ import print_function
from galgebra.printer import Format, xpdf
from galgebra.ga import Ga
In [3]:
Format()
In [4]:
g4d = Ga('a b c d')
In [5]:
(a, b, c, d) = g4d.mv()
In [6]:
g4d.g
Out[6]:
In [7]:
a | (b * c)
Out[7]:
In [8]:
a | (b ^ c)
Out[8]:
In [9]:
a | (b ^ c ^ d)
Out[9]:
In [10]:
(a | (b ^ c)) + (c | (a ^ b)) + (b | (c ^ a))
Out[10]:
In [11]:
a * (b ^ c) - b * (a ^ c) + c * (a ^ b)
Out[11]:
In [12]:
a * (b ^ c ^ d) - b * (a ^ c ^ d) + c * (a ^ b ^ d) - d * (a ^ b ^ c)
Out[12]:
In [13]:
(a ^ b) | (c ^ d)
Out[13]:
In [14]:
((a ^ b) | c) | d
Out[14]:
In [15]:
Ga.com(a ^ b, c ^ d)
Out[15]:
In [16]:
from __future__ import absolute_import, division
from __future__ import print_function
import sys
from sympy import symbols, sin, cos
from galgebra.printer import Format, xpdf, Get_Program, Print_Function
from galgebra.ga import Ga
In [17]:
Format()
coords = symbols('t x y z', real=True)
coords
Out[17]:
In [18]:
(st4d, g0, g1, g2, g3) = Ga.build(
'gamma*t|x|y|z', g=[1, -1, -1, -1], coords=coords)
In [19]:
g0
Out[19]:
In [20]:
g1
Out[20]:
In [21]:
g2
Out[21]:
In [22]:
g3
Out[22]:
In [23]:
I = st4d.i
I
Out[23]:
In [24]:
(m, e) = symbols('m e')
In [25]:
m
Out[25]:
In [26]:
e
Out[26]:
In [27]:
# 4-Vector Potential
A = st4d.mv('A', 'vector', f=True)
A
Out[27]:
In [28]:
# 8-componentrealspinor
psi = st4d.mv('psi', 'spinor', f=True)
psi
Out[28]:
In [29]:
sig_z = g3 * g0
sig_z
Out[29]:
Dirac Equation $\newcommand{bm}[1]{\boldsymbol #1} \nabla \bm{\psi} I \sigma_{z}-e\bm{A}\bm{\psi}-m\bm{\psi}\gamma_{t} = 0$
In [30]:
dirac_eq = (st4d.grad * psi) * I * sig_z - e * A * psi - m * psi * g0
dirac_eq
Out[30]:
In [31]:
dirac_eq.Fmt(2)
Out[31]:
In [32]:
dirac_eq = dirac_eq.simplify()
dirac_eq
Out[32]:
In [33]:
dirac_eq.Fmt(2)
Out[33]:
In [ ]: