~ubuntu-branches/debian/squeeze/maxima/squeeze

« back to all changes in this revision

Viewing changes to share/tensor/itensor2.dem

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2006-10-18 14:52:42 UTC
  • mto: (1.1.5 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20061018145242-vzyrm5hmxr8kiosf
ImportĀ upstreamĀ versionĀ 5.10.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
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.
 
6
 *
 
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.
 
11
 *
 
12
 * Tensor index contraction
 
13
 */
 
14
 
 
15
if get('itensor,'version)=false then load(itensor);
 
16
 
 
17
("defcon() assigns contraction properties to tensors")$
 
18
defcon(e,f,g)$
 
19
ishow(e([a],[b])*f([b],[c]))$
 
20
ishow(contract(%))$
 
21
 
 
22
("kdelta is the Kronecker delta with special contraction properties")$
 
23
 
 
24
dim:3;
 
25
ishow(contract(kdelta([a],[b])*kdelta([b],[a])))$
 
26
ishow(ev(%,kdelta))$
 
27
 
 
28
("The imetric() function sets up contraction properties for the metric")$
 
29
remcomps(g);
 
30
imetric(g)$
 
31
ishow(g([i,j],[]))$
 
32
ishow(g([],[j,k]))$
 
33
ishow(%th(1)*%th(2))$
 
34
ishow(contract(rename(expand(%))))$
 
35
 
 
36
("The contract() function can also raise and lower indices")$
 
37
defcon(Ti);
 
38
ishow(Te([i,j],[k,l])*Ti([k,m])*Ti([l,n]))$
 
39
ishow(contract(%))$
 
40
ishow(Te([i,j],[k,l])*Ti([],[i,n])*Ti([],[j,m]))$
 
41
ishow(contract(%))$
 
42
 
 
43
/* End of demo -- comment line needed by MAXIMA to resume demo menu */