57
57
user may find difficulty with the specification of the metric, function
58
58
definition, and the evaluation of differentiated "indexed" objects.
60
The @code{itensor} package can carry out differentiation with respect to an indexed
61
variable, which allows one to use the package when dealing with Lagrangian
62
and Hamiltonian formalisms. As it is possible to differentiate a field
63
Lagrangian with respect to an (indexed) field variable, one can use Maxima
64
to derive the corresponding Euler-Lagrange equations in indicial form. These
65
equations can be translated into component tensor (@code{ctensor}) programs using
66
the @code{ic_convert} function, allowing us to solve the field equations in a
67
particular coordinate representation, or to recast the equations of motion
68
in Hamiltonian form. See @code{einhil.dem} and @code{bradic.dem} for two comprehensive
69
examples. The first, @code{einhil.dem}, uses the Einstein-Hilbert action to derive
70
the Einstein field tensor in the homogeneous and isotropic case (Friedmann
71
equations) and the spherically symmetric, static case (Schwarzschild
72
solution.) The second, @code{bradic.dem}, demonstrates how to compute the Friedmann
73
equations from the action of Brans-Dicke gravity theory, and also derives
74
the Hamiltonian associated with the theory's scalar field.
77
@category{Tensors} @category{Share packages} @category{Package itensor}
60
80
@subsection New tensor notation
62
Until now, the @code{itensor} package in Maxima has used a notation that sometimes
82
Earlier versions of the @code{itensor} package in Maxima used a notation that sometimes
63
83
led to incorrect index ordering. Consider the following, for instance:
200
220
(%t11) v - v ichr2
202
222
(%i12) ishow(ev(%,ichr2))$
204
(%t12) v - g v (e p + e p - e p - e p
205
i,j %4 j %5,i ,i j %5 i j,%5 ,%5 i j
224
(%t12) v - (g v (e p + e p - e p - e p
225
i,j %4 j %5,i ,i j %5 i j,%5 ,%5 i j
209
229
(%i13) iframe_flag:true;
217
237
(%t15) v - v ifc2
219
239
(%i16) ishow(radcan(ev(%,ifc2,ifc1)))$
221
241
(%t16) - (ifg v ifb + ifg v ifb - 2 v
222
%6 j %8 i %6 i j %8 i,j
242
%6 j %7 i %6 i j %7 i,j
227
247
(%i17) ishow(canform(s([i,j],[])-s([j,i])))$
256
276
indices. Either a single index or a list of indices (which may be
257
277
null) is acceptable input (see the example under @code{covdiff}).
280
@category{Package itensor}
261
284
@deffn {Function} changename (@var{old}, @var{new}, @var{expr})
421
462
@code{contractions} is a list of those indexed objects which have been given
422
463
contraction properties with @code{defcon}.
466
@category{Package itensor}
426
470
@deffn {Function} remcon (@var{tensor_1}, ..., @var{tensor_n})
429
473
from the @var{tensor_1}, ..., @var{tensor_n}). @code{remcon(all)} removes all contraction
430
474
properties from all indexed objects.
477
@category{Package itensor}
434
481
@deffn {Function} contract (@var{expr})
449
499
a built in value already exists as with @code{ichr1}, @code{ichr2},
450
500
@code{icurvature}. See the example under @code{icurvature}.
503
@category{Package itensor}
454
507
@deffn {Function} components (@var{tensor}, @var{expr})
544
(%i5) lg:-ident(4)$lg[1,1]:1$lg;
491
553
(%i6) components(g([i,j],[]),lg);
493
555
(%i7) ishow(g([i,j],[]))$
498
560
(%i9) g([4,4],[]);
629
706
Determines the numerical suffix to be used in
630
707
generating the next dummy index in the tensor package. The prefix is
631
708
determined by the option @code{idummy} (default: @code{%}).
711
@category{Package itensor}
634
715
@deffn {Function} kdelta (@var{L1}, @var{L2})
645
726
capability. This is strictly considered a programming aid and not meant to
646
727
imply that @code{kdelta([i,j],[])} is a valid tensorial object.
730
@category{Package itensor}
650
734
@deffn {Function} kdels (@var{L1}, @var{L2})
752
842
(%i11) ishow(contract(expand(%)))$
851
@category{Package itensor}
761
855
@c HMM, WHICH CATEGORY DOES THIS FALL INTO -- FUNCTION, VARIABLE, OTHER ??
771
865
(%i1) load(itensor);
772
866
(%o1) /share/tensor/itensor.lisp
773
(%i2) el1:ishow('levi_civita([i,j,k],[])*a([],[i])*a([],[j]))$
867
(%i2) el1:ishow('levi_civita([i,j,k],[])*a([],[i])*a([],[j]))$
775
869
(%t2) a a levi_civita
779
873
(%t3) levi_civita a a
781
(%i4) ishow(canform(contract(expand(applyb1(el1,lc_l,lc_u)))))$
875
(%i4) canform(contract(expand(applyb1(el1,lc_l,lc_u))));
783
(%i5) ishow(canform(contract(expand(applyb1(el2,lc_l,lc_u)))))$
877
(%i5) canform(contract(expand(applyb1(el2,lc_l,lc_u))));
883
@category{Package itensor}
790
887
@c HMM, WHICH CATEGORY DOES THIS FALL INTO -- FUNCTION, VARIABLE, OTHER ??
795
892
many expressions more efficiently than the evaluation of @code{levi_civita}.
796
893
For details, see @code{lc_l}.
896
@category{Package itensor}
800
900
@deffn {Function} canten (@var{expr})
809
909
For this reason, @code{canten} returns an error if @code{allsym} is not
810
910
set to @code{true}.
913
@category{Package itensor}
814
917
@deffn {Function} concan (@var{expr})
815
918
Similar to @code{canten} but also performs index contraction.
921
@category{Package itensor}
819
925
@subsection Tensor symmetries
826
932
in these indices. Derivative indices are always taken to be symmetric
827
933
unless @code{iframe_flag} is set to @code{true}.
936
@category{Package itensor}
831
940
@deffn {Function} decsym (@var{tensor}, @var{m}, @var{n}, [@var{cov_1}, @var{cov_2}, ...], [@var{contr_1}, @var{contr_2}, ...])
994
@category{Package itensor}
886
998
@deffn {Function} remsym (@var{tensor}, @var{m}, @var{n})
887
999
Removes all symmetry properties from @var{tensor} which has @var{m}
888
1000
covariant indices and @var{n} contravariant indices.
1003
@category{Package itensor}
891
1007
@deffn {Function} canform (@var{expr})
1008
@deffnx {Function} canform (@var{expr}, @var{rename})
892
1009
Simplifies @var{expr} by renaming dummy
893
1010
indices and reordering all indices as dictated by symmetry conditions
894
1011
imposed on them. If @code{allsym} is @code{true} then all indices are assumed
900
1017
Also see the example under @code{decsym}. Note: @code{canform} may not be able to
901
1018
reduce an expression completely to its simplest form although it will
902
1019
always return a mathematically correct result.
1021
The optional second parameter @var{rename}, if set to @code{false}, suppresses renaming.
1024
@category{Package itensor}
905
1028
@subsection Indicial tensor calculus
917
1040
subscripted by @var{v_i} will be used for the variable of
918
1041
differentiation. This permits an array of coordinate names or
919
1042
subscripted names like @code{x[1]}, @code{x[2]}, ... to be used.
1044
A further extension adds the ability to @code{diff} to compute derivatives
1045
with respect to an indexed variable. In particular, the tensor package knows
1046
how to differentiate expressions containing combinations of the metric tensor
1047
and its derivatives with respect to the metric tensor and its first and
1048
second derivatives. This capability is particularly useful when considering
1049
Lagrangian formulations of a gravitational theory, allowing one to derive
1050
the Einstein tensor and field equations from the action principle.
1053
@category{Package itensor}
922
1057
@deffn {Function} idiff (@var{expr}, @var{v_1}, [@var{n_1}, [@var{v_2}, @var{n_2}] ...])
933
1068
@code{2*determinant(g)*ichr2([%i,k],[%i])} where the dummy index @code{%i}
934
1069
is chosen appropriately.
1072
@category{Package itensor}
939
1076
@deffn {Function} liediff (@var{v}, @var{ten})
978
1120
in @var{expr} and then carry out the differentiation by saying
979
1121
@code{ev(@var{expr}, idiff)}.
1124
@category{Package itensor}
983
1128
@deffn {Function} evundiff (@var{expr})
1190
@category{Package itensor}
1047
1194
@deffn {Function} flush (@var{expr}, @var{tensor_1}, @var{tensor_2}, ...)
1048
1195
Set to zero, in
1049
1196
@var{expr}, all occurrences of the @var{tensor_i} that have no derivative indices.
1199
@category{Package itensor}
1053
1203
@deffn {Function} flushd (@var{expr}, @var{tensor_1}, @var{tensor_2}, ...)
1054
1204
Set to zero, in
1055
1205
@var{expr}, all occurrences of the @var{tensor_i} that have derivative indices.
1208
@category{Package itensor}
1059
1212
@deffn {Function} flushnd (@var{expr}, @var{tensor}, @var{n})
1083
1240
been done then @code{idiff(x([],[i]),j)} gives @code{kdelta([i],[j])}.
1084
1241
@code{coord} is a list of all indexed objects having this property.
1244
@category{Package itensor}
1088
1248
@deffn {Function} remcoord (@var{tensor_1}, @var{tensor_2}, ...)
1100
1263
symbol @code{[]}. For example, @code{[]p([m],[n])} represents
1101
1264
@code{g([],[i,j])*p([m],[n],i,j)}.
1267
@category{Package itensor}
1105
1271
@deffn {Function} conmetderiv (@var{expr}, @var{tensor})
1212
1382
See also @code{weyl.dem} for an example that uses @code{simpmetderiv}
1213
1383
and @code{conmetderiv} together to simplify contractions of the Weyl tensor.
1386
@category{Package itensor}
1217
1390
@deffn {Function} flush1deriv (@var{expr}, @var{tensor})
1219
1392
Set to zero, in @code{expr}, all occurrences of @code{tensor} that have
1220
1393
exactly one derivative index.
1396
@category{Package itensor}
1224
1400
@subsection Tensors in curved spaces
1232
1408
The variable @code{imetric} (unbound by default), is bound to the metric, assigned by
1233
1409
the @code{imetric(@var{g})} command.
1412
@category{Package itensor}
1237
1416
@deffn {Function} idim (@var{n})
1238
1417
Sets the dimensions of the metric. Also initializes the antisymmetry
1239
1418
properties of the Levi-Civita symbols for the given dimension.
1421
@category{Package itensor}
1243
1425
@deffn {Function} ichr1 ([@var{i}, @var{j}, @var{k}])
1251
1433
To evaluate the Christoffel symbols for a particular metric, the
1252
1434
variable @code{imetric} must be assigned a name as in the example under @code{chr2}.
1437
@category{Package itensor}
1256
1441
@deffn {Function} ichr2 ([@var{i}, @var{j}], [@var{k}])
1261
1446
ichr2([i,j],[k]) = g (g + g - g )/2
1451
@category{Package itensor}
1266
1455
@deffn {Function} icurvature ([@var{i}, @var{j}, @var{k}], [@var{h}])
1419
1621
(%t3) v + icc2 v
1421
1623
(%i4) ishow(ev(%,icc2))$
1423
(%t4) v (ifc2 + ichr2 ) + v
1425
1627
(%i5) ishow(ev(%,ifc2))$
1629
(%t5) v ifg ifc1 + v
1631
(%i6) ishow(ev(%,ifc1))$
1427
1633
v ifg (ifb - ifb + ifb )
1428
1634
j %2 %1 %2 %1 j %1 j %2 i
1429
(%t5) -------------------------------------------------- + v
1635
(%t6) -------------------------------------------------- + v
1431
(%i6) ishow(ifb([a,b,c]))$
1433
(%t6) ifr ifr (ifri - ifri )
1637
(%i7) ishow(ifb([a,b,c]))$
1639
(%t7) (ifri - ifri ) ifr ifr
1443
1649
(%i8) block([iframe_bracket_form:false],ishow(ifb([a,b,c])))$
1445
(%t8) (ifr ifr - ifr ifr ) ifri
1651
(%t8) ifri (ifr ifr - ifr ifr )
1899
2157
declared totally antisymmetric in their covariant indices. Otherwise,
1900
2158
the results will be incorrect.
2161
@category{Package itensor} @category{Operators}
1904
2165
@deffn {Function} extdiff (@var{expr}, @var{i})