[GiNaC-list] Question
Vladimir V. Kisil
kisilv at maths.leeds.ac.uk
Fri Jun 17 11:10:25 CEST 2005
Hi,
>>>>> "JRG" == Javier Ros Ganuza <jros at unavarra.es> writes:
JRG> I want to do algebra with cartesian (3x1) "vectors". Cartesian
JRG> "vector"s are to be represented by a 3x1 Ginac vector (3-tuple)
JRG> and a reference to a basis that tell us in which base the
JRG> components have physical sense.
Extension of GiNaC classes is not very difficult and you may implement
from scratch.
However it may be better to do this through the Clifford algebras in
GiNaC. There are many references (e.g. books of Hestenes) on doing
geometry with Clifford algebras.
JRG> for example (in my particular jargon):
JRG> vector1.expresion=matrix(3,1,lst(a1,b1,c1));
JRG> vector1.basis=basis_k;
JRG> vector2.expresion=matrix(3,1,lst(a2,b2,c2));
JRG> vector1.basis=basis_l;
This can be implemented as follows:
varidx nu(symbol("nu", "\\nu"), 3), mu(symbol("mu", "\\mu"), 3);
xi(symbol("xi", "\\xi"), 3), rho(symbol("rho", "\\rho"),3);
basis1 = clifford_unit(mu, diag_matrix(lst(1, 1, 1)));
basis2 = clifford_unit(nu, diag_matrix(lst(1, 1, 1)));
vector1 = lst_to_clifford(lst(a1,b1,c1), xi, basis1);
vector2 = lst_to_clifford(lst(a1,b1,c1), rho, basis2);
Then the expression
JRG> result=2*vector1+vector2;
will be well defined and behave as expected even without reduction to
the single basis. The reduction is needed only if someone try to
extract its components in either basis1, basis2, or even another
basis3. To this end values of all products like basis1[i]*basis2[j]
(i.e. transition matrix) should be defined.
Best wishes,
Vladimir
--
Vladimir V. Kisil email: kisilv at maths.leeds.ac.uk
-- www: http://maths.leeds.ac.uk/~kisilv/
More information about the GiNaC-list
mailing list