Skip to content

Commit

Permalink
Update of galgebra for Barcelona conference. Most importantly correct…
Browse files Browse the repository at this point in the history
…ions

to the < and > operators for multivectors and the input of metric signature
operations requiring a normalized pseudo-scalar.  Details are in expanded
documentation.
  • Loading branch information
brombo committed Jun 20, 2015
1 parent 83e2cec commit 6cc530c
Show file tree
Hide file tree
Showing 31 changed files with 2,196 additions and 2,041 deletions.
Binary file modified galgebra-master/doc/galgebra.pdf
Binary file not shown.
2,169 changes: 1,072 additions & 1,097 deletions galgebra-master/doc/galgebra.tex

Large diffs are not rendered by default.

Binary file modified galgebra-master/examples/LaTeX/Dop.pdf
Binary file not shown.
1 change: 1 addition & 0 deletions galgebra-master/examples/LaTeX/Dop.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
(o3d, ex, ey, ez) = Ga.build('e', g=[1, 1, 1], coords=xyz_coords, norm=True)
f = o3d.mv('f', 'scalar', f=True)
lap = o3d.grad*o3d.grad
print r'\nabla =', o3d.grad
print r'%\nabla^{2} = \nabla . \nabla =', lap
print r'%\lp\nabla^{2}\rp f =', lap*f
print r'%\nabla\cdot\lp\nabla f\rp =', o3d.grad | (o3d.grad * f)
Expand Down
Binary file modified galgebra-master/examples/LaTeX/FmtChk.pdf
Binary file not shown.
2 changes: 0 additions & 2 deletions galgebra-master/examples/LaTeX/FmtChk.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
print Fmt(l,1)
print F.Fmt(3)
print B.Fmt(3)
print Fmt(l)
print Fmt(l,1)

lap = o3d.grad*o3d.grad
print r'%\nabla^{2} = \nabla\cdot\nabla =', lap
Expand Down
Binary file modified galgebra-master/examples/LaTeX/diffeq_sys.pdf
Binary file not shown.
Binary file modified galgebra-master/examples/LaTeX/em_waves_latex.pdf
Binary file not shown.
35 changes: 19 additions & 16 deletions galgebra-master/examples/LaTeX/em_waves_latex.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@

import sys
from sympy import symbols,sin,cos,exp,I,Matrix,solve,simplify
from printer import Format,xpdf,Get_Program,Print_Function
from sympy import symbols,sin,cos,exp,I,Matrix,simplify,Eq,S
from sympy.solvers import solve
from printer import Format,xpdf,Get_Program,Print_Function,Fmt
from ga import Ga
from metric import linear_expand

Expand All @@ -10,7 +11,7 @@ def EM_Waves_in_Geom_Calculus():
X = (t,x,y,z) = symbols('t x y z',real=True)
(st4d,g0,g1,g2,g3) = Ga.build('gamma*t|x|y|z',g=[1,-1,-1,-1],coords=X)

i = st4d.i
i = st4d.I()

B = st4d.mv('B','vector')
E = st4d.mv('E','vector')
Expand All @@ -31,20 +32,23 @@ def EM_Waves_in_Geom_Calculus():

print r'\text{Pseudo Scalar\;\;}I =',i
print r'%I_{xyz} =',Ixyz
F.Fmt(3,'\\text{Electromagnetic Field Bi-Vector\\;\\;} F')
print F.Fmt(3,'\\text{Electromagnetic Field Bi-Vector\\;\\;} F')
gradF = st4d.grad*F

print '#Geom Derivative of Electomagnetic Field Bi-Vector'
gradF.Fmt(3,'grad*F = 0')
print gradF.Fmt(3,'grad*F = 0')

gradF = gradF / (I * exp(I*KX))
gradF.Fmt(3,r'%\lp\bm{\nabla}F\rp /\lp i e^{iK\cdot X}\rp = 0')
print gradF.Fmt(3,r'%\lp\bm{\nabla}F\rp /\lp i e^{iK\cdot X}\rp = 0')

g = '1 # 0 0,# 1 0 0,0 0 1 0,0 0 0 -1'
g = '-1 # 0 0,# -1 0 0,0 0 -1 0,0 0 0 1'
X = (xE,xB,xk,t) = symbols('x_E x_B x_k t',real=True)
(EBkst,eE,eB,ek,et) = Ga.build('e_E e_B e_k t',g=g,coords=X)

i = EBkst.i
# The correct signature sig=p for signature (p,q) is needed
# since the correct value of I**2 is needed to compute exp(I)
(EBkst,eE,eB,ek,et) = Ga.build('e_E e_B e_k t',g=g,coords=X,sig=1)

i = EBkst.I()

E,B,k,w = symbols('E B k omega',real=True)

Expand All @@ -65,31 +69,30 @@ def EM_Waves_in_Geom_Calculus():

gradF_reduced = (EBkst.grad*F)/(I*exp(I*KX))

gradF_reduced.Fmt(3,r'%\lp\bm{\nabla}F\rp/\lp ie^{iK\cdot X} \rp = 0')
print gradF_reduced.Fmt(3,r'%\lp\bm{\nabla}F\rp/\lp ie^{iK\cdot X} \rp = 0')

print r'%\mbox{Previous equation requires that: }e_{E}\cdot e_{B} = 0\mbox{ if }B\ne 0\mbox{ and }k\ne 0'

gradF_reduced = gradF_reduced.subs({EBkst.g[0,1]:0})
gradF_reduced.Fmt(3,r'%\lp\bm{\nabla}F\rp/\lp ie^{iK\cdot X} \rp = 0')
gradF_reduced = gradF_reduced.subs({EBkst.g[0,1]:0}).expand()
print gradF_reduced.Fmt(3,r'%\lp\bm{\nabla}F\rp/\lp ie^{iK\cdot X} \rp = 0')

(coefs,bases) = linear_expand(gradF_reduced.obj)

eq1 = coefs[0]
eq2 = coefs[1]

print r'0 =', eq1
print r'0 =', eq2

B1 = solve(eq1,B)[0]
B2 = solve(eq2,B)[0]

print r'\mbox{eq1: }B =',B1
print r'\mbox{eq2: }B =',B2

eq3 = B1-B2

print r'\mbox{eq3 = eq1-eq2: }0 =',eq3
eq3 = simplify(eq3 / E)
print r'\mbox{eq3 = (eq1-eq2)/E: }0 =',eq3
print 'k =',Matrix(solve(eq3,k))

print 'B =',Matrix([B1.subs(w,k),B1.subs(-w,k)])

return
Expand Down
Binary file modified galgebra-master/examples/LaTeX/groups.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion galgebra-master/examples/LaTeX/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def main():
Get_Program()
Format()
Product_of_Rotors()
xpdf(paper=(8.5,11),debug=True)
xpdf(paper=(8.5,11))
return

if __name__ == "__main__":
Expand Down
Binary file modified galgebra-master/examples/LaTeX/latex_check.pdf
Binary file not shown.
28 changes: 17 additions & 11 deletions galgebra-master/examples/LaTeX/latex_check.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from sympy import Symbol, symbols, sin, cos, Rational, expand, simplify, collect
from printer import Format, Eprint, Get_Program, Print_Function, xpdf, Fmt
from ga import Ga, one, zero
from mv import Nga, com
from mv import Nga, com, cross

HALF = Rational(1,2)

Expand Down Expand Up @@ -30,24 +30,25 @@ def basic_multivector_operations_3D():

A = g3d.mv('A','mv')

A.Fmt(1,'A')
A.Fmt(2,'A')
A.Fmt(3,'A')
print A.Fmt(1,'A')
print A.Fmt(2,'A')
print A.Fmt(3,'A')

A.even().Fmt(1,'%A_{+}')
A.odd().Fmt(1,'%A_{-}')
print A.even().Fmt(1,'%A_{+}')
print A.odd().Fmt(1,'%A_{-}')

X = g3d.mv('X','vector')
Y = g3d.mv('Y','vector')

print 'g_{ij} = ',g3d.g

X.Fmt(1,'X')
Y.Fmt(1,'Y')
print X.Fmt(1,'X')
print Y.Fmt(1,'Y')

(X*Y).Fmt(2,'X*Y')
(X^Y).Fmt(2,'X^Y')
(X|Y).Fmt(2,'X|Y')
print (X*Y).Fmt(2,'X*Y')
print (X^Y).Fmt(2,'X^Y')
print (X|Y).Fmt(2,'X|Y')
print cross(X,Y).Fmt(1,r'X\times Y')
return

def basic_multivector_operations_2D():
Expand Down Expand Up @@ -172,6 +173,7 @@ def rounding_numerical_components():
def noneuclidian_distance_calculation():
Print_Function()
from sympy import solve,sqrt
Fmt(1)

g = '0 # #,# 0 #,# # 1'
nel = Ga('X Y e',g=g)
Expand Down Expand Up @@ -278,6 +280,7 @@ def noneuclidian_distance_calculation():
def conformal_representations_of_circles_lines_spheres_and_planes():
Print_Function()
global n,nbar
Fmt(1)
g = '1 0 0 0 0,0 1 0 0 0,0 0 1 0 0,0 0 0 0 2,0 0 0 2 0'

c3d = Ga('e_1 e_2 e_3 n \\bar{n}',g=g)
Expand Down Expand Up @@ -319,6 +322,7 @@ def conformal_representations_of_circles_lines_spheres_and_planes():
def properties_of_geometric_objects():
Print_Function()
global n, nbar
Fmt(1)
g = '# # # 0 0,'+ \
'# # # 0 0,'+ \
'# # # 0 0,'+ \
Expand Down Expand Up @@ -350,6 +354,7 @@ def properties_of_geometric_objects():

def extracting_vectors_from_conformal_2_blade():
Print_Function()
Fmt(1)
print r'B = P1\W P2'

g = '0 -1 #,'+ \
Expand Down Expand Up @@ -382,6 +387,7 @@ def extracting_vectors_from_conformal_2_blade():

def reciprocal_frame_test():
Print_Function()
Fmt(1)
g = '1 # #,'+ \
'# 1 #,'+ \
'# # 1'
Expand Down
Binary file modified galgebra-master/examples/LaTeX/lin_tran_check.pdf
Binary file not shown.
Binary file modified galgebra-master/examples/LaTeX/manifold.pdf
Binary file not shown.
25 changes: 0 additions & 25 deletions galgebra-master/examples/LaTeX/manifold.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,31 +57,6 @@
a1 = sph2d.mv('a_1','vector')
a2 = sph2d.mv('a_2','vector')

"""
V = Mlt('V',sph2d,(a1,),fct=True)
T = Mlt('T',sph2d,(a1,a2),fct=True)
print '#Tensors on the Unit Sphere'
print 'V =', V
#print 'T =', T
T.Fmt(5,'T')
print '#Tensor Contraction'
print r'T[1,2] =', T.contract(1,2)
print '#Tensor Evaluation'
print r'T(a,b) =', T(a,b)
print r'T(a,b+c) =', T(a,b+c).expand()
print r'T(a,\alpha b) =', T(a,alpha*b)
print '#Geometric Derivative With Respect To Slot'
print r'\nabla_{a_{1}}T =',T.pdiff(1)
print r'\nabla_{a_{2}}T =',T.pdiff(2)
print '#Covariant Derivatives'
print r'\mathcal{D}V =', V.cderiv()
DT = T.cderiv()
#print r'\mathcal{D}T =', DT
DT.Fmt(3,r'\mathcal{D}T')
print r'\mathcal{D}T[1,3](a) =', (DT.contract(1,3))(a)
"""
#Define curve on unit sphere manifold

us = Function('u__s')(s)
Expand Down
Binary file modified galgebra-master/examples/LaTeX/matrix_latex.pdf
Binary file not shown.
Binary file modified galgebra-master/examples/LaTeX/new_bug_grad_exp.pdf
Binary file not shown.
Binary file modified galgebra-master/examples/LaTeX/physics_check_latex.pdf
Binary file not shown.
Binary file modified galgebra-master/examples/LaTeX/print_check_latex.pdf
Binary file not shown.
36 changes: 19 additions & 17 deletions galgebra-master/examples/LaTeX/products_latex.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from printer import Format,xpdf

def main():
#Format()
Format()

coords = (x,y,z) = symbols('x y z',real=True)

Expand All @@ -27,12 +27,12 @@ def main():
for xi in X:
print ''
for yi in X:
print xi[1]+'*'+yi[1]+' =',xi[0]*yi[0]
print xi[1]+'^'+yi[1]+' =',xi[0]^yi[0]
print xi[1]+' * '+yi[1]+' =',xi[0]*yi[0]
print xi[1]+' ^ '+yi[1]+' =',xi[0]^yi[0]
if xi[1] != 's' and yi[1] != 's':
print xi[1]+'|'+yi[1]+' =',xi[0]|yi[0]
print xi[1]+'<'+yi[1]+' =',xi[0]<yi[0]
print xi[1]+'>'+yi[1]+' =',xi[0]>yi[0]
print xi[1]+' | '+yi[1]+' =',xi[0]|yi[0]
print xi[1]+' < '+yi[1]+' =',xi[0]<yi[0]
print xi[1]+' > '+yi[1]+' =',xi[0]>yi[0]

fs = o3d.mv('s','scalar',f=True)
fv = o3d.mv('v','vector',f=True)
Expand All @@ -54,12 +54,12 @@ def main():
if xi[1] == 'grad' and yi[1] == 'grad':
pass
else:
print xi[1]+'*'+yi[1]+' =',xi[0]*yi[0]
print xi[1]+'^'+yi[1]+' =',xi[0]^yi[0]
print xi[1]+' * '+yi[1]+' =',xi[0]*yi[0]
print xi[1]+' ^ '+yi[1]+' =',xi[0]^yi[0]
if xi[1] != 's' and yi[1] != 's':
print xi[1]+'|'+yi[1]+' =',xi[0]|yi[0]
print xi[1]+'<'+yi[1]+' =',xi[0]<yi[0]
print xi[1]+'>'+yi[1]+' =',xi[0]>yi[0]
print xi[1]+' | '+yi[1]+' =',xi[0]|yi[0]
print xi[1]+' < '+yi[1]+' =' ,xi[0]<yi[0]
print xi[1]+' > '+yi[1]+' =' ,xi[0]>yi[0]


(g2d,ex,ey) = Ga.build('e',coords=(x,y))
Expand All @@ -85,14 +85,16 @@ def main():
if xi[1] == 'grad' and yi[1] == 'grad':
pass
else:
print xi[1]+'*'+yi[1]+' =',xi[0]*yi[0]
print xi[1]+'^'+yi[1]+' =',xi[0]^yi[0]
print xi[1]+' * '+yi[1]+' =',xi[0]*yi[0]
print xi[1]+' ^ '+yi[1]+' =',xi[0]^yi[0]
if xi[1] != 's' and yi[1] != 's':
print xi[1]+'|'+yi[1]+' =',xi[0]|yi[0]
print xi[1]+'<'+yi[1]+' =',xi[0]<yi[0]
print xi[1]+'>'+yi[1]+' =',xi[0]>yi[0]
print xi[1]+' | '+yi[1]+' =',xi[0]|yi[0]
else:
print xi[1]+' | '+yi[1]+' = Not Allowed'
print xi[1]+' < '+yi[1]+' =',xi[0]<yi[0]
print xi[1]+' > '+yi[1]+' =' ,xi[0]>yi[0]

#xpdf(paper='letter')
xpdf(paper='letter')
return

if __name__ == "__main__":
Expand Down
Binary file modified galgebra-master/examples/LaTeX/reflect_test.pdf
Binary file not shown.
Binary file modified galgebra-master/examples/LaTeX/simple_test_latex.pdf
Binary file not shown.
Loading

0 comments on commit 6cc530c

Please sign in to comment.