1 /** @file exam_noncommut.cpp
3 * Here we test manipulations on GiNaC's lortensors. */
6 * GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #if 0 // this will change
27 static unsigned lortensor_check1(void)
29 // checks simple identities of the metric tensor!
32 lorentzidx mu("mu"), nu("nu");
33 ex e1, e2, e3, e4, e5, e6;
34 e1 = lortensor_g(mu,nu);
35 e2 = lortensor_g(nu,mu);
36 e3 = e1 - e2; // g(~mu,~nu) - g(~nu,~mu) = 0 !
37 e4 = lortensor_g(mu,mu.toggle_covariant());
38 e5 = lortensor_g(mu.toggle_covariant(),mu);
39 e6 = e4 - e5; // g(~mu,_mu) - g(_mu,~mu) = 0!
41 clog << e1 << "-" << e2 << " erroneously returned "
42 << e3 << " instead of 0" << endl;
46 clog << e4 << "-" << e5 << " erroneously returned "
47 << e6 << " instead of 0" << endl;
54 static unsigned lortensor_check2(void)
56 // checks simple contraction properties of an arbitrary (symmetric!) rankn lortensor!
59 lorentzidx mu("mu"), nu("nu"), rho("rho");
60 ex e1, e2, e3, e4, e5, e6, e7, e8, e9, e10;
61 e1 = lortensor_g(mu,nu);
62 e2 = lortensor_g(nu,mu);
63 e3 = lortensor_rank1("p",mu.toggle_covariant());
64 e4 = lortensor_rank1("p",nu);
65 e5 = e3 * e1 - e3 * e2; // p_mu g(~mu,~nu) - p_mu g(~nu,~mu) = 0!
66 e6 = simplify_lortensor(e3 * e1) - e4; // p~nu - p~nu = 0!
67 e7 = lortensor_g(nu,rho);
68 e8 = lortensor_rank2("F",mu.toggle_covariant(),nu.toggle_covariant());
69 e9 = lortensor_rank2("F",mu.toggle_covariant(),rho);
70 e10 = simplify_lortensor(e8 * e7) - e9; // F(_mu,_nu) g(~nu,~rho) - F(_mu,~rho) = 0!
72 clog << e3 << "*" << e1 << "-" << e3 << "*" << e2 << " erroneously returned "
73 << e5 << " instead of 0" << endl;
77 clog << " simplify_lortensor(e3 * e1)" << "-" << e4 << " erroneously returned"
78 << e6 << " instead of 0" << endl;
82 clog << " simplify_lortensor(e8 * e7)" << "-" << e9 << " erroneously returned"
83 << e10 << " instead of 0" << endl;
92 unsigned exam_noncommut(void)
96 cout << "examining behaviour of noncommutative objects" << flush;
97 clog << "----------behaviour of noncommutative objects:" << endl;
100 result += lortensor_check1(); cout << '.' << flush;
101 result += lortensor_check2(); cout << '.' << flush;
105 cout << " passed " << endl;
106 clog << "(no output)" << endl;
108 cout << " failed " << endl;