On Tue, Jul 12, 2005 at 10:35:22PM +0200, Richard B. Kreckel wrote:
On Tue, 28 Jun 2005, Sheplyakov Alexei wrote:
On Tue, Jun 21, 2005 at 09:15:38PM +0200, Javier Ros Ganuza wrote:
I think the following expressions are mathematically equivalent:
cout << (indexed(matrix(3,1, lst(a1,b1,c1)), mu.toggle_variance ())+indexed(matrix(3,1, lst(a2,b2,c2)), mu.toggle_variance ())).simplify_indexed()*basis1 << endl;
cout << ((indexed(matrix(3,1, lst(a1,b1,c1)), mu.toggle_variance ())+indexed(matrix(3,1, lst(a2,b2,c2)), mu.toggle_variance ()))*basis1).simplify_indexed() << endl;
cout << (indexed(matrix(3,1, lst(a1,b1,c1)), mu.toggle_variance ())*basis1+indexed(matrix(3,1, lst(a2,b2,c2)), mu.toggle_variance ())*basis1).simplify_indexed() << endl;
Where
varidx mu(symbol("mu", "\\mu"), 3); ex basis1 = clifford_unit(mu, diag_matrix(lst(1, 1, 1)),1);
But output is different
[[a2+a1],[b1+b2],[c2+c1]].mu*e~mu [[a2],[b2],[c2]].mu*e~mu+[[a1],[b1],[c1]].mu*e~mu [[a2],[b2],[c2]].mu*e~mu+[[a1],[b1],[c1]].mu*e~mu [snip]
This question tends to become a FAQ.
Can you suggest the wording for such a FAQ entry?
I will try. ---------------------------- cut here ------------------------------- Q1: 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 A: Declare `a' as a matrix. Otherwise, these expressions are meaningless. The `indexed' class (and most of derived classes) is intended for tensor manipulation without referring to a particular basis. Thus, the `indexed' class is well suited for calculations involving (formally defined) tensor algebra of non-integer-dimensional space. This is particularly useful for evaluation of Feynman integrals in the framework of dimensional regularization. On the other hand, the `matrix' class is _not_ treated as a tensor, so mixing matrices with indexed objects typically gives meaningless result. Q2: I'd like to know if is it possible to unroll indexed objects. As example, I would like to do something like this a_i a~i = (a_1)^2 + (a_2)^2 + (a_3)^2 + ... A: You should use matrix instead of indexed. See also Q1. ---------------------------- cut here ------------------------------- I've also written a simple demo program, see attached file. Best regards, Alexei. -- ROOT: an octopus made by nailing extra legs onto a cat.