Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
climoivre removed for further development
  • Loading branch information
dprodanov committed Jul 3, 2016
1 parent 353bfca commit b7b4704
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 132 deletions.
72 changes: 45 additions & 27 deletions clifford.mac
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ ratprint:false;
else expand((a.b + cinvolve(b).cinvolve(a))/2);
*/

wedgesimp:true;
inprotype:sym;

declare("|", additive);
Expand All @@ -115,10 +116,12 @@ ratprint:false;
if not mapatom(b) then b:expand(b),
if inop(a)="+" then return (map( lambda ([u], u | b), a)),
if inop(b)="+" then return (map( lambda ([u], a | u), b)),
if not freeof(".", a) then
a:cliffsimp1(a),
if not freeof(".", b) then
b:cliffsimp1(b),
if wedgesimp then (
if not freeof(".", a) then
a:cliffsimp1(a),
if not freeof(".", b) then
b:cliffsimp1(b)
),
l:maxgrade(a),
r:maxgrade(b),
qq: l-r,
Expand Down Expand Up @@ -162,7 +165,13 @@ ratprint:false;
if mapatom(a) and mapatom(b) then
if a#b then return(a.b)
else return (0),


if wedgesimp then (
if not freeof(".", a) then
a:cliffsimp1(a),
if not freeof(".", b) then
b:cliffsimp1(b)
),
[ra, la]: oppart(a, lambda([u], freeof ("~", u) and scalarp(u) )),
ra:subst(nil=1, ra),
la:subst(nil=1, la),
Expand Down Expand Up @@ -206,10 +215,12 @@ ratprint:false;
if not mapatom(b) then b:expand(b),
if inop(a)="+" then return (map( lambda ([u], u & b), a)),
if inop(b)="+" then return (map( lambda ([u], a & u), b)),
if not freeof(".", a) then
a:cliffsimp1(a),
if not freeof(".", b) then
b:cliffsimp1(b),
if wedgesimp then (
if not freeof(".", a) then
a:cliffsimp1(a),
if not freeof(".", b) then
b:cliffsimp1(b)
),
l:maxgrade(a),
r:maxgrade(b),
/*display(l,r),*/
Expand Down Expand Up @@ -351,9 +362,30 @@ permsign(arr):=block([k:0, len, ret:0 ] ,
);

/*
simplification rules
Abstract Cliford algebra construction
*/
matchdeclare([aa, ee], lambda([u], not freeof(asymbol,u) and freeof ("+", u) and not scalarp(u) ), [bb,cc], true, [kk, mm, nn], integerp);
matchdeclare([aa, ee], lambda([u], not freeof(asymbol,u) and freeof ("+", u) and not scalarp(u) ), [bb,cc], true,
[kk, mm, nn], lambda( [z], integerp(z) and z>0));

if get('clifford,'version)=false then (
tellsimp(aa[kk].aa[kk], signature[kk] ),
tellsimpafter(aa[kk].aa[mm], dotsimp2(aa[kk].aa[mm])),
tellsimpafter(bb.ee.cc, dotsimpc(bb.ee.cc)),
tellsimp(bb^nn, bb^^nn)
);

/* experimental code*/
if get('clifford,'version)=false then (
/* simplification of powers
tellsimpafter(aa[kk]^nn, powsimp(aa[kk]^nn)),*/
tellsimpafter(aa[kk]^^nn, powsimp(aa[kk]^^nn)),
/* simplification of involution*/
tellsimpafter('cinvolve('cinvolve(bb)), bb)
);

/*
simplification rules
*/
matchdeclare(dd, lambda([u], freeof(asymbol, u)), gg, lambda([u], not freeof(asymbol, u)));
matchdeclare(ds, lambda([u], not freeof(asymbol, u) and not (freeof("^", u) or freeof("^^", u) ) ), rn, numberp);

Expand Down Expand Up @@ -436,9 +468,9 @@ cinv(ab):=block( [s, b, u:1],
/*
simplification of exponents
*/
powsimp(aa):=block( [a,k,p:1],
powsimp(aa):=block( [a, k, p:1],
if atom(aa) then return(aa),
if op(aa)="^^" or op(aa)="^" then (
if inop(aa)="^^" then (
a:inpart(aa,1),
k:inpart(aa,2),
for j:1 thru k do
Expand All @@ -448,20 +480,6 @@ powsimp(aa):=block( [a,k,p:1],
else aa
);

/*
Abstract Cliford algebra construction
*/
if get('clifford,'version)=false then (
tellsimp(aa[kk].aa[kk], signature[kk] ),
tellsimpafter(aa[kk].aa[mm], dotsimp2(aa[kk].aa[mm])),
tellsimpafter(bb.ee.cc, dotsimpc(bb.ee.cc)),
tellsimpafter(bb*ee, subst("*"=".", bb*ee)),
/* simplification of powers*/
tellsimp(bb^nn, (bb^^nn)),
tellsimpafter(aa[kk]^^nn, powsimp(aa[kk]^^nn)),
/* simplification of involution*/
tellsimpafter('cinvolve('cinvolve(bb)), bb)
);


/*
Expand Down
93 changes: 0 additions & 93 deletions climoivre.mac

This file was deleted.

15 changes: 6 additions & 9 deletions rtest_clifford2.mac
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,17 @@ e[1] . e[2] . e[1] . e[2], dotsimpc;
-1$
e[2] . e[1] . e[1] . e[2], dotsimpc;
1$
/*inverses*/
1/e[2],dotinvsimp;
-e[2]$
1/e[1] . e[2], dotinvsimp;
-e[1] . e[2]$
1/(1+e[1]),cliffsimpall,expand;
1/2-e[1]/2$
(e[1]- e[2])^^2,expand;
-2$
(e[1]- e[2])^2,expand;
-2$
block(
"init clifford geom/pauli",
clifford(e,3),
Expand Down Expand Up @@ -115,12 +120,4 @@ block(
jacobprod(a,b,c):= ( a & b & c + b & c & a + c & a & b),
ev(jacobprod(e[1] ,e[2], e[3]), dotsimpc)
);
3*(e[1] . e[2] . e[3])$
/*
clidet([e[1] ,e[2],e[3] ,e[1]]);
0$
clidet([e[1] ,e[2],e[3] ,e[2]]);
0$
clidet([e[1] ,e[2],e[3] ,e[3]]);
0$
*/
3*(e[1] . e[2] . e[3])$
14 changes: 11 additions & 3 deletions rtest_clifford4.mac
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ batch("rtest_clifford", test);
'done$
get('clifford,'version);
v20$
a | b + a & b;
a.b$
/*a | b + a & b;
a.b$*/
(A1: a & b &c + b & c & a + c& a &b,
ratsimp(A1+(- a . b . c - a . c . 'cinvolve(b)+a . 'cinvolve(c) . 'cinvolve(b)+
'cinvolve(a) . 'cinvolve(b) . 'cinvolve(c)- b . a . 'cinvolve(c)+b . 'cinvolve(a)
Expand Down Expand Up @@ -73,4 +73,12 @@ rot:R1.rr.R2,cliffsimpall;
(g[1]*cos(phi/2)^2+g[1]*sin(phi/2)^2)*t+(g[2]*cos(phi/2)^2+2*g[3]*cos(phi/2)*sin(phi/2)-g[2]*sin(phi/2)^2)*x+
(g[3]*cos(phi/2)^2-2*g[2]*cos(phi/2)*sin(phi/2)-g[3]*sin(phi/2)^2)*y+(g[4]*cos(phi/2)^2+g[4]*sin(phi/2)^2)*z$
trigreduce(rot);
g[1]*t+g[2]*cos(phi)*x+g[3]*sin(phi)*x+g[3]*cos(phi)*y-g[2]*sin(phi)*y+g[4]*z$
g[1]*t+g[2]*cos(phi)*x+g[3]*sin(phi)*x+g[3]*cos(phi)*y-g[2]*sin(phi)*y+g[4]*z$
/*
clidet([e[1] ,e[2],e[3] ,e[1]]);
0$
clidet([e[1] ,e[2],e[3] ,e[2]]);
0$
clidet([e[1] ,e[2],e[3] ,e[3]]);
0$
*/

0 comments on commit b7b4704

Please sign in to comment.