1 /* Copyright (C) 2005 Viktor T. Toth <http://www.vttoth.com/>
3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU General Public License as
5 * published by the Free Software Foundation; either version 2 of
6 * the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be
9 * useful, but WITHOUT ANY WARRANTY; without even the implied
10 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
13 * Demonstrating the Hodge star operation
16 ("Using the hodge() function")$
17 if get('itensor,'version)=false then load(itensor);
18 ("We set up a standard metric")$
21 ("To avoid index conflicts, choose a suitable counter value")$
23 ("Declare the antisymmetric properties of a 3-form")$
24 decsym(A,3,0,[anti(all)],[])$
25 ("Now compute the dual of the 3-form")$
27 ishow(canform(hodge(%)))$
28 ("And compute the dual again")$
29 ishow(canform(hodge(%th(2))))$
30 ("After simplification, we should get back the original 3-form up to sign")$
33 ishow(canform(contract(expand(%))))$
34 ("The sign is (-1)^(p*(n-p)), in this case -1^3, which is correct.")$
36 ("Let's try another example")$
37 decsym(F,2,0,[anti(all)],[])$
39 ishow(canform(hodge(%)))$
40 ishow(canform(hodge(%)))$
43 ishow(canform(contract(expand(%))))$
45 ("And here's the Hodge star of the exterior product of two vectors")$
46 ishow(v([i],[])*w([j],[])-v([j],[])*w([i],[]))$
47 ishow(canform(hodge(%)))$
48 ishow(canform(hodge(%)))$
51 ishow(canform(contract(expand(%))))$
54 /* End of demo -- comment line needed by MAXIMA to resume demo menu */