Are Clifford units of different bases equal?
Hello all, I think that I can explain myself better with this simplistic example (THE OUTPUTS OF COUTS ARE INLINED): //gcc -o main1 main1.cc -lginac -lcln #include <ginac/ginac.h> using namespace std; using namespace GiNaC; int main(){ realsymbol a1("a1"), b1("b1"), c1("c1"); varidx nu(symbol("nu", "\\nu"), 3), mu(symbol("mu", "\\mu"), 3); ex basis1 = clifford_unit(mu, diag_matrix(lst(1, 1, 1)),0), basis2 = clifford_unit(nu, diag_matrix(lst(1, 1, 1)),1); ex vector1 = lst_to_clifford(lst(a1,b1,c1), mu, basis1), vector2 = lst_to_clifford(lst(a1,b1,c1), nu, basis2); ex result=2*vector1+vector2; cout << result << endl; //GIVES: e~nu*[[a1],[b1],[c1]].nu+2*[[a1],[b1],[c1]].mu*e~mu cout << result.expand(expand_options::expand_indexed).simplify_indexed() << endl; //GIVES: 3*e~nu*[[a1],[b1],[c1]].nu cout << expand_dummy_sum(result) << endl; //GIVES: 3*a1*e~0+3*c1*e~2+3*b1*e~1 cout << canonicalize_clifford(expand_dummy_sum(result)) << endl; //GIVES: 3*a1*e~0+3*c1*e~2+3*b1*e~1 } So I understand that basis1 and basis2 are the units of two different bases, the last parameter (0 or 1) in the call of clifford_unit(...) does not affect the output (about this parameter the tutorial says: "optional parameter rl allows to distinguish different Clifford algebras (wich will commute each other))". I recognize that I don't understand the meaning of "wich will commute each other" ). I understand then that vector1 and vector2 are vectors with the same components but with different bases. But Outputs reveal: Output 1: Clifford_unit names are the same for both bases Output 2: Clifford_units are the same for both bases Output 3: Clifford_units are the same for both bases Output 4: Clifford_units are the same for both bases Is this intended behaviour? Can it be changed so that Outputs can be something like this: e_basis2~nu*[[a1],[b1],[c1]].nu+2*[[a1],[b1],[c1]].mu*e_basis1~mu e_basis2~nu*[[a1],[b1],[c1]].nu+2*[[a1],[b1],[c1]].mu*e_basis1~mu 2*a1*e_basis2~0+2*c1*e_basis2~2+2*b1*e_basis2~1+a1*e_basis1~0 +c1*e_basis1~2+b1*e_basis1~1 2*a1*e_basis2~0+2*c1*e_basis2~2+2*b1*e_basis2~1+a1*e_basis1~0 +c1*e_basis1~2+b1*e_basis1~1 ??? Another question: In expresion vector1*vector2, Does * stands for the Inner product? How can I write a expression involving the Outer product? As Vladimir may remember, this is a rework of a example that appeared in this list a couple of years ago. I have implemented a multibody dynamics kernel based in GiNaC around clases derived form GiNaC's matrix, but I want to investigate this path also. Javier PD: I'm ussing ginac-1.3.4-1.fc4 for if it is relevant.
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
The reason of this (and misunderstanding which you expressed) is your calls:
ex vector1 = lst_to_clifford(lst(a1,b1,c1), mu, basis1), vector2 = lst_to_clifford(lst(a1,b1,c1), nu, basis2);
Here how GiNaC tutorial describes *two* versions of lst_to_clifford:
ex lst_to_clifford(const ex & v, const ex & mu, const ex & metr, unsigned char rl = 0); ex lst_to_clifford(const ex & v, const ex & e);
which converts a list or vector `v = (v~0, v~1, ..., v~n)' into the Clifford number `v~0 e.0 + v~1 e.1 + ... + v~n e.n' with `e.k' directly supplied in the second form of the procedure. In the first form the Clifford unit `e.k' is generated by the call of `clifford_unit(mu, metr, rl)'.
In other words if the code which you provide is runnable on your (presumably old) version of GiNaC it calls the first version. Then a *new* clifford_units is created for both vector1 and vector1. Both new clifford_units have the same metric which they obtain from basis1 and basis2, and both they the same representation labels 0 (the default value). The values of representation labels in basis1 and basis2 are not consulted in this form of the call. 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
as you seems initially expected. Best wishes, Vladimir -- Vladimir V. Kisil email: kisilv@maths.leeds.ac.uk -- www: http://maths.leeds.ac.uk/~kisilv/
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 ...? Thanks in advance 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))
Dear Javier,
"JRG" == Javier Ros Ganuza <jros@unavarra.es> writes: JRG> It works in ginac-1.3.4
It seems that 1.4 branch contains some improvements which were not implemented in 1.3. >> > e~0*a1+2*e~2*c1+2*e~0*a1+2*b1*e~1+b1*e~1+e~2*c1 JRG> Wonderfully I obtain JRG> 3*a1*e~0+3*c1*e~2+3*b1*e~1 JRG> It seems that the call to canonicalize_clifford asumes that the JRG> units of both bases are equal, but this is not a problem for JRG> me. This should be again due to the difference between 1.3 and 1.4 branches. JRG> In order to do some practice in clifford algebra in GiNNaC I'm JRG> trying to do Cliford Geommetric Algebra operations in Cl2. ..... JRG> They doesn't expand as can be seen. It works on my computer with GiNaC 1.4, but I have to change dimensionality of indexes to 2. I include the new program with few more lines of the additional checks and its output, so you could see yourself. Best wishes, Vladimir -- Vladimir V. Kisil email: kisilv@maths.leeds.ac.uk -- www: http://maths.leeds.ac.uk/~kisilv/ #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"), 2), mu(symbol("mu", "\\mu"), 2); 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; cout << "Expanded multivectora * multivectorb = " << (multivectora * clifford_bar(multivectorb)).expand()<< endl; cout << "Canonicalized multivectora * multivectorb = " << canonicalize_clifford((multivectora * clifford_bar(multivectorb)).expand())<< endl; } ================================================================ ---------- multivectora = a0+(e~0*e~1)*a3+e~1*a2+a1*e~0 multivectorb = b0+e~0*b1+b2*e~1+b3*(e~0*e~1) ---------- multivectora + multivectorb = b0+e~0*b1+a0+(e~0*e~1)*a3+b2*e~1+e~1*a2+b3*(e~0*e~1)+a1*e~0 multivectora * multivectorb = (a0+(e~0*e~1)*a3+e~1*a2+a1*e~0)*(b0-e~0*b1-b2*e~1+(e~1*e~0)*b3) Expanded multivectora * multivectorb = -a1*ONE*b1-e~0*e~1*a2*b1-(e~0*e~1)*a3*b2*e~1+(e~1*e~0)*b3*a0-a0*e~0*b1-b2*ONE*a2+a1*(e~1*e~0)*b3*e~0-a1*b2*e~0*e~1-(e~0*e~1)*a3*e~0*b1+(e~1*e~0)*b3*(e~0*e~1)*a3+b0*a0+(e~1*e~0)*b3*e~1*a2+a1*b0*e~0+b0*(e~0*e~1)*a3+b0*e~1*a2-a0*b2*e~1 Canonicalized multivectora * multivectorb = -e~0*e~1*a2*b1-(e~0*e~1)*a3*b2*e~1-ONE*b2*a2-b3*(e~0*e~1*e~0*e~1)*a3-a0*e~0*b1-a1*b2*e~0*e~1-(e~0*e~1)*a3*e~0*b1+b0*a0+a1*b0*e~0-a1*ONE*b1-b3*a0*(e~0*e~1)+b0*(e~0*e~1)*a3-b3*(e~0*e~1)*e~1*a2-a1*b3*(e~0*e~1)*e~0+b0*e~1*a2-a0*b2*e~1
This should be again due to the difference between 1.3 and 1.4 branches.
I'll will install CVS version to follow. It was my mistake letting the varidx to have dimension 3, as you say they must be of dimension 2. Mean while, I see that geometric products of type e~1*e~1 are being simplified to ONE, that I suppose that can be removed using ex remove_dirac_ONE(const ex & e) Also I see in a0+(e~0*e~1)*a3+e~1*a2+a1*e~0 that e~1*e~0 expresions are outputed like (e~0*e~1). (e~0*e~1) stands for a GiNaC's symbol (single 2-blade) or a product of two GiNaC's symbols (product of two 1-blades). If I want to trigger specific simplifications for the Cl2 geometric algebra, like (e~1*e~0)=-(e~0*e~1) or e~0*(e~0*e~1)=e~1 e~0*e~1*e~0*e~1=-1 I suppose that I will have to do them myself using ().subs(), don't I? Thanks again, it has been very helpfull. Javier
Dear Javier,
"JRG" == Javier Ros Ganuza <jros@unavarra.es> writes: JRG> I'll will install CVS version to follow.
I think it should go smooth. JRG> Mean while, I see that geometric products of type e~1*e~1 are JRG> being simplified to ONE, that I suppose that can be removed JRG> using JRG> ex remove_dirac_ONE(const ex & e) That function is intended only for an expression e which has a form (a Clifford scalar) * ONE. You could not remove ONE from the expression 2*ONE+3*e~1, since it will become an invalid GiNaC expression (a commuting object cannot be added to a non-commuting one). JRG> Also I see in JRG> a0+(e~0*e~1)*a3+e~1*a2+a1*e~0 JRG> that e~1*e~0 expresions are outputed like (e~0*e~1). In this way GiNaC highlights that (e~0*e~1) is a non-commutative product times some other commuting terms. JRG> If I want to trigger specific simplifications for the Cl2 JRG> geometric algebra, like JRG> (e~1*e~0)=-(e~0*e~1) GiNaC just put in expression in a "canonical form" which means some "canonical order". If you simply declare e00 and e01 in the reverse order GiNaC would output (e~1*e~0) as -(e~0*e~1). JRG> e~0*(e~0*e~1)=e~1 JRG> e~0*e~1*e~0*e~1=-1 All that should be done by canonicalize_clifford() method. Just remember that it should be called manually whenever you need it. Best wishes, Vladimir -- Vladimir V. Kisil email: kisilv@maths.leeds.ac.uk -- www: http://maths.leeds.ac.uk/~kisilv/
participants (2)
-
Javier Ros Ganuza
-
Vladimir Kisil