* Here we test manipulations on GiNaC's indexed objects. */
/*
- * GiNaC Copyright (C) 1999-2003 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "exams.h"
// Lorentz transformation matrix (boost along x axis)
matrix L(4, 4);
- L(0, 0) = gamma;
- L(0, 1) = -beta*gamma;
- L(1, 0) = -beta*gamma;
- L(1, 1) = gamma;
- L(2, 2) = 1; L(3, 3) = 1;
+ L = gamma, -beta*gamma, 0, 0,
+ -beta*gamma, gamma, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1;
// Electromagnetic field tensor
- matrix F(4, 4, lst(
- 0, -Ex, -Ey, -Ez,
+ matrix F(4, 4);
+ F = 0, -Ex, -Ey, -Ez,
Ex, 0, -Bz, By,
Ey, Bz, 0, -Bx,
- Ez, -By, Bx, 0
- ));
+ Ez, -By, Bx, 0;
// Indices
symbol s_mu("mu"), s_nu("nu"), s_rho("rho"), s_sigma("sigma");
e = indexed(p, mu.toggle_variance(), mu) - indexed(p, nu, nu.toggle_variance());
result += check_equal_simplify(e, 0);
+ // GiNaC 1.2.1 had a bug here because p.i*p.i -> (p.i)^2
+ e = indexed(p, i) * indexed(p, i) * indexed(p, j) + indexed(p, j);
+ ex fi = exprseq(e.get_free_indices());
+ if (!fi.is_equal(exprseq(j))) {
+ clog << "get_free_indices(" << e << ") erroneously returned "
+ << fi << " instead of (.j)" << endl;
+ ++result;
+ }
+
return result;
}