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

« back to all changes in this revision

Viewing changes to share/tensor/itensor4.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
 * Demonstrating special tensors
 
13
 */
 
14
if get('itensor,'version)=false then load(itensor);
 
15
("the Kronecker delta is defined the usual way")$
 
16
ishow(kdelta([i],[j]))$
 
17
ishow(kdelta([i,j],[n,m]))$
 
18
ishow(kdelta([i,j,k],[l,n,m]))$
 
19
 
 
20
("A symmetricized version is also defined, useful in many calculations:")$
 
21
ishow(kdels([i],[l]))$
 
22
ishow(kdels([i,j],[l,k]))$
 
23
ishow(kdels([i,j,k],[l,m,n]))$
 
24
ishow(ev(kdels([],[]),kdelta))$
 
25
 
 
26
("Contraction of such kdels and kdelta gives zero.  Look at the huge sum")$
 
27
ishow(expand(kdels([i,j,k],[l,m,n])*kdelta([l,m,n],[i1,i2,i3])))$
 
28
ishow(contract(%))$
 
29
 
 
30
("Another example")$
 
31
("take the symmetrization of A_ijk")$
 
32
ishow(contract(expand(a([i1,j1,k1],[])*kdels([i,j,k],[i1,j1,k1]))))$
 
33
 
 
34
("The Levi-Civita symbol accepts numeric and symbolic arguments:")$
 
35
dim:3;
 
36
levi_civita([1,2,3]);
 
37
levi_civita([i,j,j],[]);
 
38
%,kdelta;
 
39
("The lc2kdt function simplifies the unevaluated Levi-Civita symbol")$
 
40
ishow('levi_civita([i,j,k],[])*a([],[j])*
 
41
      'levi_civita([],[k,l,n])*b([l],[])*c([n],[]))$
 
42
ishow(contract(expand(lc2kdt(%))))$
 
43
 
 
44
ishow('levi_civita([i,j,k],[])*a([],[j])*b([],[k])*'levi_civita([],[i,l,n])*c([l],[])*u([n],[]))$
 
45
ishow(contract(expand(lc2kdt(%))))$
 
46
 
 
47
("Two simplification rules process Levi-Civita index patterns")$
 
48
ishow('levi_civita([i,j,k],[])*a([],[j])*a([],[k])+'levi_civita([],[i,j,k])*a([j])*b([k]))$
 
49
applyb1(%,lc_l,lc_u)$
 
50
ishow(factor(canform(contract(expand(%)))))$
 
51
 
 
52
("Finally look for the dualization of the antisymmetric tensor B")$
 
53
decsym(B,2,0,[anti(all)],[]);
 
54
ishow(B([i,j],[]))$
 
55
("Compute the dualization")$
 
56
rank:length(covi(B([i,j],[])))$
 
57
dual:ishow('levi_civita([],[l,i,j])*B([i,j],[])/rank!)$
 
58
("Return to the original")$
 
59
ishow('levi_civita([i2,j2,l],[])*dual)$
 
60
ishow(canform(contract(expand(lc2kdt(%)))))$
 
61
 
 
62
/* End of demo -- comment line needed by MAXIMA to resume demo menu */