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 basics
15 if get('itensor,'version)=false then load(itensor);
17 ("Tensors are indexed objects. To show a tensor use ishow()")$
18 ishow(g([a,b],[c,i],i2,i1))$
20 ("Tensor components can be assigned using components().
21 As an example, consider a conformally flat metric:")$
26 components(g([i,j],[]),e([i,j],[])*p([],[]));
27 components(g([],[i,j]),e([],[i,j])/p([],[]));
31 ("Tensor components can also be assigned as MAXIMA functions:")$
32 t(l1,l2):=c*a(l1,l2)+b(l1,l2)$
36 ("Here is the Euler equation")$
37 Eu(l1,l2):=d_t*v(l1,[])+v([],[j])*v(l1,[],j)+
38 1/rho([])*diff(p([],[]),l1[1])+diff(phi([],[]),l1[1])$
40 ("Another definition can be given using the metric g")$
41 Eu(l1,l2):=block([j1:idummy()], if l2=[] then
42 d_t* v(l1,[])+v([],[j1])*v(l1,[],j1)+
43 1/rho([])*diff(p([],[]),l1[1])+diff(phi([],[]),l1[1])
44 else d_t*v([],l2)+v([],[j1])*v([],l2,j1)+
45 g([],[l2[1],j1])*(diff(p([],[]),j1)/rho([])+diff(phi([],[]),j1)))$
48 ("The dummy index character can be changed from % using idummyx:")$
52 ("The indices() command lists the free and dummy indices")$
55 ("The variable icounter controls the dummy index numbering")$
62 /* End of demo -- comment line needed by MAXIMA to resume demo menu */