1 /* Copyright (C) 2021 Viktor T. Toth <https://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 * ITENSOR scalar field Laplacian demo
16 if get('itensor,'version)=false then load(itensor)$
18 ("First, we set up the basic properties of the system")$
21 ("Demo is faster in 3D but works for other values of dim, too")$
24 ("We declare symmetries of the metric and other symbols")$
25 decsym(g,2,0,[sym(all)],[])$
26 decsym(g,0,2,[],[sym(all)])$
27 components(g([a],[b]),kdelta([a],[b]))$
28 decsym(levi_civita,0,dim,[],[anti(all)])$
29 decsym(itr,2,1,[anti(all)],[])$
31 ("It is useful to set icounter to avoid indexing conflicts")$
34 ("We choose the appropriate convention for exterior algebra")$
37 ("For this problem, better simplifications are achieved with flipflag")$
40 ("Now let us calculate the Laplacian of a scalar field and simplify")$
41 hodge(extdiff(hodge(extdiff(f([],[])))/sqrt(determinant(g))))*sqrt(determinant(g))$
42 canform(rename(contract(expand(lc2kdt(%)))))$
44 D1:ishow(canform(rename(contract(canform(%)))))$
46 ("We can re-express the result using Christoffel symbols, too")$
47 ishow(rename(contract(canform(conmetderiv(D1,g)))))$
49 ("Nice. Now let us repeat the same calculation with torsion")$
52 hodge(extdiff(hodge(extdiff(f([],[])))/sqrt(determinant(g))))*sqrt(determinant(g))$
53 canform(rename(contract(expand(lc2kdt(%)))))$
55 canform(rename(contract(canform(%))))$
57 D2:ishow(contract(ev(contract(canform(%)),g)))$
59 ("Another clean result; can also be expressed using Christoffel symbols")$
60 ishow(rename(contract(canform(conmetderiv(D2,g)))))$
62 ("Finally, we see that the two results differ only by torsion")$
65 ("Last but not least, d^2 is not nilpotent in the presence of torsion")$
66 extdiff(extdiff(f([],[]),i),j)$
70 ishow(rename(contract(%)))$
72 ("Reminder: when dim = 2n, the Laplacian is -1 times these results.")$
73 /* End of demo -- comment line needed by MAXIMA to resume demo menu */