2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License as
4 * published by the Free Software Foundation; either version 2 of
5 * the License, or (at your option) any later version.
7 * This program is distributed in the hope that it will be
8 * useful, but WITHOUT ANY WARRANTY; without even the implied
9 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10 * PURPOSE. See the GNU General Public License for more details.
12 * Indicial tensor simplification and symmetries
15 if get('itensor,'version)=false then load(itensor);
17 ("Take a tensor s. Remove any symmetry rules")$
19 exp:ishow(s([i,j],[])-s([j,i],[]))$
21 ("The canform function applies symmetry rules. None yet defined")$
24 ("We tell MAXIMA that s is symmetric using decsym")$
25 decsym(s,2,0,[sym(all)],[])$
28 ("The flag allsym causes all tensors to be treated as symmetric")$
30 canform(a([i,j],[])-a([j,i],[]));
32 ("But this setting can lead to incorrect results, so it's off by default")$
35 ("The function rename can be used on dummy indices")$
36 exp:ishow(a([i,j1],[])*b([],[j1,k])+a([i,j2],[])*b([],[j2,k]))$
39 ("The variable idummyx controls the dummy name, icounter is the counter")$
43 ("To simplify tensor expressions, use rename, canform and canten")$
45 ("In this example, we want to drop terms higher order in l")$
46 (ratfac:false,ratvars(l),ratweight(l,1),ratwtlvl:1);
49 components(g([i,j],[]),e([i,j],[])+2*l*p([i,j],[]));
50 components(g([],[i,j]),e([],[i,j])-2*l*p([],[i,j]));
53 exp:ishow(icurvature([s,u,n],[y]))$
55 ("Look the number of terms with nterms")$
57 ishow(canform(contract(rename(ratexpand(exp)))))$
59 /* End of demo -- comment line needed by MAXIMA to resume demo menu */