Hello, On Mon, Apr 25, 2005 at 03:06:56PM +0100, Vladimir Kisil wrote:
I am wondering how to convince GiNaC that the following to expressions are equal:
[[-1,0],[0,1]~mu~mu * a~mu [[-1,0],[0,1].nu~mu * a~nu
First of all, I'm wondering how to convince _me_ that those expressions are equal: the second expression is a vector, and the first one looks like diagonal elements of a tensor of the 3'rd rank. Second. Probably, you expected that [[-1,0],[0,1]~mu~mu * a~mu is [-a~0, a~1]. [[-1, 0], [0, 1]].nu~mu * a~nu is [ -a~0, a~1] too. But that is NOT the case with GiNaC. In general: expression a.i a~i has very little to do with a_0 a_0 - a_1 a_1 - ... - a_N a_N for a good reason (GiNaC is (was?) a library for calculation of Feynman integrals, so dimension of indices are NOT required to be positive integers). N.B.: The `matrix' class CAN be used with indices to do some simple linear algebra (probably, just to add more confusion). But this code #include <iostream> #include <ginac/ginac.h> using namespace std; using namespace GiNaC; int main(int argc, char** argv) { varidx i(symbol("i"), 2); varidx j(symbol("j"), 2); matrix mink2_matr(2, 2, lst(-1, 0, 0, 1)); matrix a(1, 2, lst(symbol("a0"), symbol("a1"))); ex test1 = indexed(mink2_matr, i, i)*indexed(a, i); ex test2 = indexed(mink2_matr, j.toggle_variance(), i)*indexed(a, j); cout << test1 << " = " << test1.simplify_indexed() << endl; cout << test2 << " = " << test2.simplify_indexed() << endl; return 0; } gives [[a0,a1]]~i*[[-1,0],[0,1]]~i~i = [[a0,a1]]~i*[[-1,0],[0,1]]~i~i [[a0,a1]]~j*[[-1,0],[0,1]].j~i = [[-a0,a1]]~i (once again: first expression is a tensor 3'rd rank, while second expression is a vector) So, (unless I'm missing something fundamental) you are out of luck... -- ROOT: an octopus made by nailing extra legs onto a cat.