# [GiNaC-list] Wonderfull!!. WAS: Are Clifford units of different bases equal?

Javier Ros Ganuza jros at unavarra.es
Wed May 9 12:21:40 CEST 2007

On Tue, 2007-05-08 at 20:30 +0100, Vladimir Kisil wrote:
> 		Dear Javier,
>
> 		I am using 1.4 branch of GiNaC on my computer and your example
>   compiles but do not run on it throwing the exception:
>
> > terminate called after throwing an instance of 'std::invalid_argument'
> >  what():  clifford_unit(): metric for Clifford unit must be of type
> >  tensor, matrix or an expression with two free indices
> > Aborted
>

It works in ginac-1.3.4

>  ....
>  If you replace your calls to:
>
> > ex     vector1 = lst_to_clifford(lst(a1,b1,c1), basis1),
> >        vector2 = lst_to_clifford(lst(a1,b1,c1), basis2);
>
>   then both metrics and representation labels are inherited from basis1
>   and basis2 and output of your example will be:
>
> > [[a1],[b1],[c1]].nu*e~nu+2*e~mu*[[a1],[b1],[c1]].mu
> > [[a1],[b1],[c1]].nu*e~nu+2*[[a1],[b1],[c1]].nu*e~nu
> > e~0*a1+2*e~2*c1+2*e~0*a1+2*b1*e~1+b1*e~1+e~2*c1
> > e~0*a1+2*e~2*c1+2*e~0*a1+2*b1*e~1+b1*e~1+e~2*c1
>

Wonderfully I obtain

2*e~mu*[[a1],[b1],[c1]].mu+[[a1],[b1],[c1]].nu*e~nu
2*e~mu*[[a1],[b1],[c1]].mu+e~mu*[[a1],[b1],[c1]].mu
2*a1*e~0+a1*e~0+2*c1*e~2+c1*e~2+2*b1*e~1+b1*e~1
3*a1*e~0+3*c1*e~2+3*b1*e~1

It seems that the call to canonicalize_clifford
asumes that the units of both bases are equal, but this is not a problem
for me.

>  as you seems initially expected.
>

Yes!!!

In order to do some practice in clifford algebra in GiNNaC I'm trying to
do Cliford Geommetric Algebra operations in Cl2. I'm attaching the
simplistic code and the output an the end. But I have a problem
expanding:

a/ multivectora * clifford_bar(multivectorb) or

b/ multivectora * multivectorb

They doesn't expand as can be seen. What can I do to expand them
( ().expand() gives a runtime error)?.

If I want to make the geometric product (geometric product $a*b=a \dot b + a \wedge b$), what should I do a/ or b/ or ...?

Javier

-----------Listing-----------------
$less clifford_geometric_algebra.cc //gcc -o clifford_geometric_algebra clifford_geometric_algebra.cc -lginac -lcln #include <ginac/ginac.h> using namespace std; using namespace GiNaC; int main(){ realsymbol a0("a0"), a1("a1"), a2("a2"), a3("a3"), b0("b0"), b1("b1"), b2("b2"), b3("b3"); varidx nu(symbol("nu", "\\nu"), 3), mu(symbol("mu", "\\mu"), 3); ex basis1 = clifford_unit(mu, diag_matrix(lst(1, 1)),0); ex e00 = basis1.subs(mu == 0), e01 = basis1.subs(mu == 1); //cout << latex; cout << "----------" << endl; ex multivectora=a0+a1*e00+a2*e01+a3*(e00*e01), multivectorb=b0+b1*e00+b2*e01+b3*(e00*e01); cout << "multivectora = " << multivectora << endl; cout << "multivectorb = " << expand_dummy_sum(multivectorb) << endl; cout << "----------" << endl; ex result=multivectora + multivectorb; cout << "multivectora + multivectorb = " << multivectora + multivectorb << endl; result=multivectora * multivectorb; cout << "multivectora * multivectorb = " << multivectora * clifford_bar(multivectorb)<< endl; }$ ./clifford_geometric_algebra
----------
multivectora = a2*e~1+a0+a3*(e~0*e~1)+a1*e~0
multivectorb = b2*e~1+e~0*b1+b3*(e~0*e~1)+b0
----------
multivectora + multivectorb = b2*e~1+a2*e~1+e~0*b1+a0
+a3*(e~0*e~1)+b3*(e~0*e~1)+b0+a1*e~0
multivectora * multivectorb = (a2*e~1+a0
+a3*(e~0*e~1)+a1*e~0)*(-b2*e~1-e~0*b1+b0+b3*(e~1*e~0))