Mon Feb 16 10:40:47 MST 1998 aquarius% mupad *----* MuPAD 1.4.0 -- Multi Processing Algebra Data Tool /| /| *----* | Copyright (c) 1997 - 98 by SciFace Software GmbH | *--|-* All rights reserved. |/ |/ *----* Licensed to: Michael Wester >> # ----------[ M u P A D ]---------- # >> # ---------- Initialization ---------- # >> TEXTWIDTH:= 80: >> read("../../Time.mupad"): >> # ---------- Tensor Analysis ---------- # >> # 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. # >> #kdelta([i, k], [j, h]);# >> # Levi-Civita symbol: [epsilon(2,1,3), epsilon(1,3,1)] => [-1, 0] # >> # 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]] # >> export(Dom): export(linalg): >> matrix:= Matrix(ExpressionField(normal)): >> a:= matrix([[1, -2], [3, 4]]): >> b:= matrix([[5, 6], [-7, 8]]): >> combinat::cartesian(a, b); Error: argument(s) must be set(s) or non-negative integer(s) [combinat::cartesian] >> # Modification of a solution due to Mark van Hoeij. # >> Kronecker:= proc(A, B) &> local i, j, k, l; &> begin &> matrix([seq(seq([seq(seq(A[i,j]*B[k,l], l = 1..linalg::ncols(B)), &> j = 1..linalg::ncols(A))], &> k = 1..linalg::nrows(B)), &> i = 1..linalg::nrows(A))]) &> end_proc: >> Kronecker(a, b); +- -+ | 5, 6, -10, -12 | | | | -7, 8, 14, -16 | | | | 15, 18, 20, 24 | | | | -21, 24, -28, 32 | +- -+ Time: 4830 msec Type: Dom::Matrix(Dom::ExpressionField(normal, iszero@normal)) >> # A variant solution # >> matrx:= Matrix(SquareMatrix(2, ExpressionField(normal))): >> Kronecker2:= proc(A, B) &> local i, j, k, l; &> begin &> matrx([seq([seq(matrix([seq([seq(A[i,j]*B[k,l], l = 1..linalg::ncols(B))], &> k = 1..linalg::ncols(B))]), &> j = 1..linalg::nrows(A))], &> i = 1..linalg::nrows(A))]) &> end_proc: >> Kronecker2(a, b); +- -+ | +- -+ +- -+ | | | 5, 6 | | -10, -12 | | | | |, | | | | | -7, 8 | | 14, -16 | | | +- -+ +- -+ | | | | +- -+ +- -+ | | | 15, 18 | | 20, 24 | | | | |, | | | | | -21, 24 | | -28, 32 | | | +- -+ +- -+ | +- -+ Time: 4720 msec Type: Dom::Matrix(Dom::SquareMatrix(2, Dom::ExpressionField(nor\ mal, iszero@normal))) >> a:= NIL: >> b:= NIL: >> # 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 # >> # 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 # >> T([i], [j]); T([i], [j]) Time: 460 msec Type: "function" >> # 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 # >> # ---------- Quit ---------- # >> quit real 12.79 user 11.88 sys 0.78