1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
/* Original version of this file copyright 1999 by Michael Wester,
* and retrieved from http://www.math.unm.edu/~wester/demos/TensorAnalysis/problems.macsyma
* circa 2006-10-23.
*
* Released under the terms of the GNU General Public License, version 2,
* per message dated 2007-06-03 from Michael Wester to Robert Dodier
* (contained in the file wester-gpl-permission-message.txt).
*
* See: "A Critique of the Mathematical Abilities of CA Systems"
* by Michael Wester, pp 25--60 in
* "Computer Algebra Systems: A Practical Guide", edited by Michael J. Wester
* and published by John Wiley and Sons, Chichester, United Kingdom, 1999.
*/
/* ----------[ M a c s y m a ]---------- */
/* ---------- Initialization ---------- */
showtime: all$
prederror: false$
/* ---------- Tensor Analysis ---------- */
init_itensor()$
/* Generalized Kronecker delta: delta([j, h], [i, k]) =
delta(j, i) delta(h, k) - delta(j, k) delta(h, i). See David Lovelock and
Hanno Rund, _Tensors, Differential Forms, & Variational Principles_, John
Wiley & Sons, Inc., 1975, p. 109. */
ishow(kdelta([i, k, @j, @h]));
/* Levi-Civita symbol: [epsilon(2,1,3), epsilon(1,3,1)] => [-1, 0] */
[levi_civita([2, 1, 3]), levi_civita([1, 3, 1])];
/* Tensor outer product: [[ 5 6] [-10 -12]]
[1 -2] [ 5 6] [[ -7 8] [ 14 -16]]
ij ij [3 4] X [-7 8] = [ ]
c = a b [[ 15 18] [ 20 24]]
kl kl [[-21 24] [-28 32]] */
a: matrix([1, -2], [3, 4])$
b: matrix([5, 6], [-7, 8])$
outermap("*", a, b);
remvalue(a, b)$
/* Definition of the Christoffel symbol of the first kind (a is the metric
tensor) [Lovelock and Rund, p. 81]
d a d a d a
1 kh hl lk
Chr1 = - (----- + ----- - -----)
lhk 2 l k h
d x d x d x */
imetric: a$
ishow(ichr1([l, h, k]));
/* Partial covariant derivative of a type (1, 1) tensor field (Chr2 is the
Christoffel symbol of the second kind) [Lovelock and Rund, p. 77]
i d i i m m i
T = ---- T + Chr2 T - Chr2 T
j|k k j m k j j k m
d x */
ishow(T([@i, j]));
ishow(covdiff(%, k));
/* Verify the Bianchi identity for a symmetric connection (K is the Riemann
curvature tensor) [Lovelock and Rund, p. 94]
h h h
K + K + K = 0
i jk|l i kl|j i lj|k */
ishow(covdiff(icurvature([@h, i, j, k]), l) +
covdiff(icurvature([@h, i, k, l]), j) +
covdiff(icurvature([@h, i, l, j]), k));
canform(%);
/* ---------- Quit ---------- */
quit();
|