Maxima 5.14.0cvs http://maxima.sourceforge.net Using Lisp CLISP 2.35 (2005-08-29) Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. (%i1) batching /home/vttoth/dev/maxima/share/tensor/tensor.dem At the _ prompt, type ';' followed by enter to get next demo (%i2) load(tendemo.mac) This is the main demonstration program for MAXIMA tensors. The following demos are available: INDICIAL TENSOR MANIPULATION COMPONENT TENSOR MANIPULATION 1. Basics 11. Initialization 2. Index contraction 12. Differential geometry 3. Simplification and symmetries 13. Gravitational theory 4. Special tensors 14. Frame fields 5. Coordinate differentiation 15. Torsion and nonmetricity 6. Covariant derivatives, curvature 16. Algebraic classification 7. Exterior algebra 17. Differential equations 8. Generating CTENSOR programs 18. Using Taylor series 9. Frames, torsion, nonmetricity A. Algebraic tensor manipulation E. Complete examples X. Exit this demo Select an option by its number followed by a semicolon (;) 1; batching /home/vttoth/dev/maxima/share/tensor/itensor1.dem At the _ prompt, type ';' followed by enter to get next demo (%i1) if get('itensor, 'version) = false then load(itensor) (%o1) /home/vttoth/dev/maxima/share/tensor/itensor.lisp (%i2) Tensors are indexed objects. To show a tensor use ishow() (%i3) ishow(g([a, b], [c, i], i2, i1)) c i (%t3) g a b,i2 i1 (%i4) Tensor components can be assigned using components(). As an example, consider a conformally flat metric: (%i5) declare(e, constant) (%o5) done (%i6) remcomps(g) (%o6) done (%i7) imetric(g) (%o7) done (%i8) components(g([i, j], []), e([i, j], []) p([], [])) (%o8) done e([], [i, j]) (%i9) components(g([], [i, j]), -------------) p([], []) (%o9) done (%i10) ishow(g([i, j], [])) (%t10) p e i j (%i11) ishow(g([], [i, j])) i j e (%t11) ---- p (%i12) Tensor components can also be assigned as MAXIMA functions: (%i13) t(l1, l2) := b(l1, l2) + c a(l1, l2) (%i14) ishow(t([i, k], [])) (%t14) b + c a i k i k (%i15) ishow(t([], [j, m])) j m j m (%t15) a c + b (%i16) Here is the Euler equation diff(p([], []), l1 ) 1 (%i17) Eu(l1, l2) := diff(phi([], []), l1 ) + -------------------- 1 rho([]) + v([], [j]) v(l1, [], j) + d_t v(l1, []) (%i18) ishow(Eu([i], [])) j (%t18) v v + d_t v i,j i (%i19) Another definition can be given using the metric g (%i20) Eu(l1, l2) := block([j1 : idummy()], diff(p([], []), l1 ) 1 if l2 = [] then diff(phi([], []), l1 ) + -------------------- 1 rho([]) + v([], [j1]) v(l1, [], j1) + d_t v(l1, []) diff(p([], []), j1) else g([], [l2 , j1]) (diff(phi([], []), j1) + -------------------) 1 rho([]) + v([], [j1]) v([], l2, j1) + d_t v([], l2)) (%i21) ishow(Eu([i], [])) %1 (%t21) v v + d_t v i,%1 i (%i22) ishow(Eu([], [i])) i %2 i (%t22) v d_t + v v ,%2 (%i23) The dummy index character can be changed from % using idummyx: (%i24) idummyx : n (%i25) ishow(Eu([i], [])) n3 (%t25) v v + d_t v i,n3 i (%i26) The indices() command lists the free and dummy indices (%i27) indices(Eu([i], [])) (%o27) [[i], [n4]] (%i28) The variable icounter controls the dummy index numbering (%i29) icounter (%o29) 4 (%i30) icounter : 100 (%o30) 100 (%i31) ishow(Eu([i], [])) n101 (%t31) v v + d_t v i,n101 i (%i32) idummyx : % INDICIAL TENSOR MANIPULATION COMPONENT TENSOR MANIPULATION 1. Basics 11. Initialization 2. Index contraction 12. Differential geometry 3. Simplification and symmetries 13. Gravitational theory 4. Special tensors 14. Frame fields 5. Coordinate differentiation 15. Torsion and nonmetricity 6. Covariant derivatives, curvature 16. Algebraic classification 7. Exterior algebra 17. Differential equations 8. Generating CTENSOR programs 18. Using Taylor series 9. Frames, torsion, nonmetricity A. Algebraic tensor manipulation E. Complete examples X. Exit this demo Select an option by its number followed by a semicolon (;) 2; batching /home/vttoth/dev/maxima/share/tensor/itensor2.dem At the _ prompt, type ';' followed by enter to get next demo (%i1) if get('itensor, 'version) = false then load(itensor) (%o1) /home/vttoth/dev/maxima/share/tensor/itensor.lisp (%i2) defcon() assigns contraction properties to tensors (%i3) defcon(e, f, g) (%i4) ishow(e([a], [b]) f([b], [c])) b c (%t4) e f a b (%i5) ishow(contract(%)) c (%t5) g a (%i6) kdelta is the Kronecker delta with special contraction properties (%i7) dim : 3 (%o7) 3 (%i8) ishow(contract(kdelta([a], [b]) kdelta([b], [a]))) (%t8) kdelta (%i9) ishow(ev(%, kdelta)) (%t9) 3 (%i10) The imetric() function sets up contraction properties for the metric (%i11) remcomps(g) (%o11) done (%i12) imetric(g) (%i13) ishow(g([i, j], [])) (%t13) g i j (%i14) ishow(g([], [j, k])) j k (%t14) g (%i15) ishow(%th(1) %th(2)) j k (%t15) g g i j (%i16) ishow(contract(rename(expand(%)))) k (%t16) kdelta i (%i17) The contract() function can also raise and lower indices (%i18) defcon(Ti) (%o18) done (%i19) ishow(Te([i, j], [k, l]) Ti([k, m]) Ti([l, n])) k l (%t19) Te Ti Ti i j k m l n (%i20) ishow(contract(%)) (%t20) Te i j n m (%i21) ishow(Te([i, j], [k, l]) Ti([], [i, n]) Ti([], [j, m])) i n j m k l (%t21) Ti Ti Te i j (%i22) ishow(contract(%)) n m k l (%t22) Te INDICIAL TENSOR MANIPULATION COMPONENT TENSOR MANIPULATION 1. Basics 11. Initialization 2. Index contraction 12. Differential geometry 3. Simplification and symmetries 13. Gravitational theory 4. Special tensors 14. Frame fields 5. Coordinate differentiation 15. Torsion and nonmetricity 6. Covariant derivatives, curvature 16. Algebraic classification 7. Exterior algebra 17. Differential equations 8. Generating CTENSOR programs 18. Using Taylor series 9. Frames, torsion, nonmetricity A. Algebraic tensor manipulation E. Complete examples X. Exit this demo Select an option by its number followed by a semicolon (;) 3; batching /home/vttoth/dev/maxima/share/tensor/itensor3.dem At the _ prompt, type ';' followed by enter to get next demo (%i1) if get('itensor, 'version) = false then load(itensor) (%o1) /home/vttoth/dev/maxima/share/tensor/itensor.lisp (%i2) Take a tensor s. Remove any symmetry rules (%i3) remsym(s, 2, 0) (%o3) done (%i4) exp : ishow(s([i, j], []) - s([j, i], [])) (%t4) s - s i j j i (%i5) The canform function applies symmetry rules. None yet defined (%i6) ishow(canform(exp)) (%t6) s - s i j j i (%i7) We tell MAXIMA that s is symmetric using decsym (%i8) decsym(s, 2, 0, [sym(all)], []) (%i9) canform(exp) (%o9) 0 (%i10) The flag allsym causes all tensors to be treated as symmetric (%i11) allsym : true (%o11) true (%i12) canform(a([i, j], []) - a([j, i], [])) (%o12) 0 (%i13) But this setting can lead to incorrect results, so it's off by default (%i14) allsym : false (%o14) false (%i15) The function rename can be used on dummy indices (%i16) exp : ishow(a([i, j2], []) b([], [j2, k]) + a([i, j1], []) b([], [j1, k])) j2 k j1 k (%t16) b a + b a i j2 i j1 (%i17) ishow(rename(exp)) %1 k (%t17) 2 b a i %1 (%i18) The variable idummyx controls the dummy name, icounter is the counter (%i19) idummyx : n (%o19) n (%i20) ishow(rename(exp)) n1 k (%t20) 2 b a i n1 (%i21) To simplify tensor expressions, use rename, canform and canten (%i22) declare(e, constant) (%o22) done (%i23) In this example, we want to drop terms higher order in l (%i24) (ratfac : false, ratvars(l), ratweight(l, 1), ratwtlvl : 1) (%o24) 1 (%i25) remcomps(g) (%o25) done (%i26) imetric(g) (%o26) done (%i27) components(g([i, j], []), 2 l p([i, j], []) + e([i, j], [])) (%o27) done (%i28) components(g([], [i, j]), e([], [i, j]) - 2 l p([], [i, j])) (%o28) done (%i29) ishow(g([i, j], [])) (%t29) 2 p l + e i j i j (%i30) ishow(g([], [i, j])) i j i j (%t30) e - 2 p l (%i31) exp : ishow(icurvature([s, u, n], [y])) y y n1 y y n1 (%t31) ichr2 + ichr2 ichr2 - ichr2 - ichr2 ichr2 s u,n n1 n s u s n,u n1 u s n (%i32) exp : ev(exp) (%i33) Look the number of terms with nterms (%i34) nterms(exp) (%o34) 90 (%i35) ishow(canform(contract(rename(ratexpand(exp))))) y n1 y n1 y y (%t35) l p + e l p + e l p + l p u,n s s u,n n1 n s,n1 u n,s u INDICIAL TENSOR MANIPULATION COMPONENT TENSOR MANIPULATION 1. Basics 11. Initialization 2. Index contraction 12. Differential geometry 3. Simplification and symmetries 13. Gravitational theory 4. Special tensors 14. Frame fields 5. Coordinate differentiation 15. Torsion and nonmetricity 6. Covariant derivatives, curvature 16. Algebraic classification 7. Exterior algebra 17. Differential equations 8. Generating CTENSOR programs 18. Using Taylor series 9. Frames, torsion, nonmetricity A. Algebraic tensor manipulation E. Complete examples X. Exit this demo Select an option by its number followed by a semicolon (;) 4; batching /home/vttoth/dev/maxima/share/tensor/itensor4.dem At the _ prompt, type ';' followed by enter to get next demo (%i1) if get('itensor, 'version) = false then load(itensor) (%o1) /home/vttoth/dev/maxima/share/tensor/itensor.lisp (%i2) the Kronecker delta is defined the usual way (%i3) ishow(kdelta([i], [j])) j (%t3) kdelta i (%i4) ishow(kdelta([i, j], [n, m])) n m m n (%t4) kdelta kdelta - kdelta kdelta i j i j (%i5) ishow(kdelta([i, j, k], [l, n, m])) l n m m n (%t5) kdelta (kdelta kdelta - kdelta kdelta ) i j k j k l n m m n - kdelta (kdelta kdelta - kdelta kdelta ) j i k i k n m m n l + (kdelta kdelta - kdelta kdelta ) kdelta i j i j k (%i6) A symmetricized version is also defined, useful in many calculations: (%i7) ishow(kdels([i], [l])) l (%t7) kdelta i (%i8) ishow(kdels([i, j], [l, k])) k l l k (%t8) kdelta kdelta + kdelta kdelta i j i j (%i9) ishow(kdels([i, j, k], [l, m, n])) l m n n m (%t9) kdelta (kdelta kdelta + kdelta kdelta ) i j k j k l m n n m + kdelta (kdelta kdelta + kdelta kdelta ) j i k i k m n n m l + (kdelta kdelta + kdelta kdelta ) kdelta i j i j k (%i10) ishow(ev(kdels([], []), kdelta)) (%t10) 4 (%i11) Contraction of such kdels and kdelta gives zero. Look at the huge sum (%i12) ishow(expand(kdels([i, j, k], [l, m, n]) kdelta([l, m, n], [i1, i2, i3]))) l m n i1 i2 i3 (%t12) kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n m l n i1 i2 i3 + kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n l n m i1 i2 i3 + kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n n l m i1 i2 i3 + kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n m n l i1 i2 i3 + kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n n m l i1 i2 i3 + kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n l m n i2 i1 i3 - kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n m l n i2 i1 i3 - kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n l n m i2 i1 i3 - kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n n l m i2 i1 i3 - kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n m n l i2 i1 i3 - kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n n m l i2 i1 i3 - kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n l m n i1 i3 i2 - kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n m l n i1 i3 i2 - kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n l n m i1 i3 i2 - kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n n l m i1 i3 i2 - kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n m n l i1 i3 i2 - kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n n m l i1 i3 i2 - kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n l m n i3 i1 i2 + kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n m l n i3 i1 i2 + kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n l n m i3 i1 i2 + kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n n l m i3 i1 i2 + kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n m n l i3 i1 i2 + kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n n m l i3 i1 i2 + kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n l m n i2 i3 i1 + kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n m l n i2 i3 i1 + kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n l n m i2 i3 i1 + kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n n l m i2 i3 i1 + kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n m n l i2 i3 i1 + kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n n m l i2 i3 i1 + kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n l m n i3 i2 i1 - kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n m l n i3 i2 i1 - kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n l n m i3 i2 i1 - kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n n l m i3 i2 i1 - kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n m n l i3 i2 i1 - kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n n m l i3 i2 i1 - kdelta kdelta kdelta kdelta kdelta kdelta i j k l m n (%i13) ishow(contract(%)) (%t13) 0 (%i14) Another example (%i15) take the symmetrization of A_ijk (%i16) ishow(contract(expand(a([i1, j1, k1], []) kdels([i, j, k], [i1, j1, k1])))) (%t16) a + a + a + a + a + a k j i k i j j k i j i k i k j i j k (%i17) The Levi-Civita symbol accepts numeric and symbolic arguments: (%i18) dim : 3 (%o18) 3 (%i19) levi_civita([1, 2, 3]) (%o19) 1 (%i20) levi_civita([i, j, j], []) (%o20) kdelta([i, j, j], [1, 2, 3]) (%i21) ev(%, kdelta) (%o21) 0 (%i22) The lc2kdt function simplifies the unevaluated Levi-Civita symbol (%i23) ishow(levi_civita([i, j, k], []) a([], [j]) levi_civita([], [k, l, n]) b([l], []) c([n], [])) j k l n (%t23) a levi_civita levi_civita b c i j k l n (%i24) ishow(contract(expand(lc2kdt(%)))) n l (%t24) a b c - a c b i n i l (%i25) ishow(levi_civita([i, j, k], []) a([], [j]) b([], [k]) levi_civita([], [i, l, n]) c([l], []) u([n], [])) i l n j k (%t25) levi_civita a b levi_civita c u i j k l n (%i26) ishow(contract(expand(lc2kdt(%)))) l n l n (%t26) a b c u - b a c u l n l n (%i27) Two simplification rules process Levi-Civita index patterns (%i28) ishow(levi_civita([], [i, j, k]) a([j]) b([k]) + levi_civita([i, j, k], []) a([], [j]) a([], [k])) i j k j k (%t28) levi_civita a b + a a levi_civita j k i j k (%i29) applyb1(%, lc_l, lc_u) (%i30) ishow(factor(canform(contract(expand(%))))) %1 %2 i levi_civita (a b - b a ) %1 %2 %1 %2 (%t30) -------------------------------------- 2 (%i31) Finally look for the dualization of the antisymmetric tensor B (%i32) decsym(B, 2, 0, [anti(all)], []) (%o32) done (%i33) ishow(B([i, j], [])) (%t33) B i j (%i34) Compute the dualization (%i35) rank : length(covi(B([i, j], []))) levi_civita([], [l, i, j]) B([i, j], []) (%i36) dual : ishow(----------------------------------------) rank! l i j levi_civita B i j (%t36) --------------------- 2 (%i37) Return to the original (%i38) ishow(levi_civita([i2, j2, l], []) dual) l i j levi_civita B levi_civita i j i2 j2 l (%t38) ---------------------------------------- 2 (%i39) ishow(canform(contract(expand(lc2kdt(%))))) (%t39) B i2 j2 INDICIAL TENSOR MANIPULATION COMPONENT TENSOR MANIPULATION 1. Basics 11. Initialization 2. Index contraction 12. Differential geometry 3. Simplification and symmetries 13. Gravitational theory 4. Special tensors 14. Frame fields 5. Coordinate differentiation 15. Torsion and nonmetricity 6. Covariant derivatives, curvature 16. Algebraic classification 7. Exterior algebra 17. Differential equations 8. Generating CTENSOR programs 18. Using Taylor series 9. Frames, torsion, nonmetricity A. Algebraic tensor manipulation E. Complete examples X. Exit this demo Select an option by its number followed by a semicolon (;) 5; batching /home/vttoth/dev/maxima/share/tensor/itensor5.dem At the _ prompt, type ';' followed by enter to get next demo (%i1) if get('itensor, 'version) = false then load(itensor) (%o1) /home/vttoth/dev/maxima/share/tensor/itensor.lisp (%i2) Partial differentiation with respect to a coordinate (%i3) ishow(idiff(f([], []), k)) (%t3) f ,k (%i4) ishow(idiff(v([i], []), k)) (%t4) v i,k (%i5) ishow(idiff(a([i], [j]), k)) j (%t5) a i,k (%i6) Partial differentiation is a commutative operation (%i7) ishow(idiff(idiff(v([i], []), k), l) - idiff(idiff(v([i], []), l), k)) (%t7) 0 (%i8) Unless a frame base is used (%i9) iframe_flag : true (%o9) true (%i10) ishow(idiff(idiff(v([i], []), k), l) - idiff(idiff(v([i], []), l), k)) (%t10) v - v i,k l i,l k (%i11) iframe_flag : false (%o11) false (%i12) To undo a partial differentation, use the undiff function (%i13) ishow(v([i], [], k)) (%t13) v i,k (%i14) exp : ishow(undiff(%)) (%t14) idiff(v , k, 1) i (%i15) Use rediff to evaluate all occurrences of idiff() again (%i16) ishow(rediff(exp)) (%t16) v i,k (%i17) These are useful for tensors that cannot be evaluated in derivative form (%i18) exp : ishow(icurvature([i, j, k], [m], n)) m (%t18) icurvature i j k,n (%i19) Evaluation of this expression causes an error (%i20) errcatch(ev(exp, nouns)) (%o20) [] (%i21) Here is when undiff, ev, rediff helps, which is what evundiff does (%i22) ishow(evundiff(exp)) m m %1 m %1 (%t22) - ichr2 - ichr2 ichr2 - ichr2 ichr2 i k,j n %1 j i k,n %1 j,n i k m m %1 m %1 + ichr2 + ichr2 ichr2 + ichr2 ichr2 i j,k n %1 k i j,n %1 k,n i j INDICIAL TENSOR MANIPULATION COMPONENT TENSOR MANIPULATION 1. Basics 11. Initialization 2. Index contraction 12. Differential geometry 3. Simplification and symmetries 13. Gravitational theory 4. Special tensors 14. Frame fields 5. Coordinate differentiation 15. Torsion and nonmetricity 6. Covariant derivatives, curvature 16. Algebraic classification 7. Exterior algebra 17. Differential equations 8. Generating CTENSOR programs 18. Using Taylor series 9. Frames, torsion, nonmetricity A. Algebraic tensor manipulation E. Complete examples X. Exit this demo Select an option by its number followed by a semicolon (;) 6; batching /home/vttoth/dev/maxima/share/tensor/itensor6.dem At the _ prompt, type ';' followed by enter to get next demo (%i1) if get('itensor, 'version) = false then load(itensor) (%o1) /home/vttoth/dev/maxima/share/tensor/itensor.lisp (%i2) Covariant differentiation is carried out relative to a metric (%i3) remcomps(g) (%o3) done (%i4) imetric(g) (%o4) done (%i5) We declare the metric's symmetry properties (%i6) decsym(g, 2, 0, [sym(all)], []) (%o6) done (%i7) decsym(g, 0, 2, [], [sym(all)]) (%o7) done (%i8) MAXIMA can express both kinds of Christoffel symbols (%i9) ishow(ichr1([i, j, k])) g + g - g j k,i i k,j i j,k (%t9) ------------------------ 2 (%i10) ishow(ichr2([i, j], [k])) k %1 g (g - g + g ) j %1,i i j,%1 i %1,j (%t10) ----------------------------------- 2 (%i11) The covariant derivative uses the Christoffel symbols (%i12) ishow(covdiff(a([j, k], [i]), i)) i %2 i i %2 i %2 (%t12) - a ichr2 + a + ichr2 a - a ichr2 j %2 k i j k,i %2 i j k %2 k j i (%i13) exp : ishow(canform(contract(expand(ev(%, ichr2))))) %36 %37 %1 %2 %34 %35 %1 %2 g g g a g g g a ,%1 %2 %36 %37 j k ,%2 %1 %34 %35 j k (%t13) - ------------------------------ + ------------------------------ 2 2 %32 %33 %1 %2 g g g a ,j %1 %32 %2 %33 k %1 + ------------------------------- + a 2 j k,%1 %2 %3 %30 %31 %1 %2 %3 %28 %29 %1 g g g g a g g g g a ,%1 %2 %30 %3 %31 j k ,%3 %1 %28 %2 %29 j k - ------------------------------------ + ------------------------------------ 2 2 %2 %3 %26 %27 %1 %40 %41 %2 %1 g g g g a g g g a ,%3 %1 %26 %2 %27 j k ,%2 %1 %40 %41 k j - ------------------------------------ - ------------------------------ 2 2 %24 %25 %2 %1 %38 %39 %1 %2 g g g a g g g a ,k %1 %24 %2 %25 j ,%2 %1 %38 %39 k j + ------------------------------- + ------------------------------ 2 2 (%i14) To drop first derivatives of the metric, use igeodesic_coords (%i15) ishow(igeodesic_coords(exp, g)) %1 (%t15) a j k,%1 (%i16) Covariant derivatives of a vector do not commute (%i17) covdiff(v([], [i]), k, l) - covdiff(v([], [i]), l, k) (%i18) comm : ishow(factor(canform(%))) %1 %2 i %2 i i (%t18) v (ichr2 ichr2 - ichr2 ichr2 - ichr2 %1 k %2 l %1 l %2 k %1 l,k i + ichr2 ) %1 k,l (%i19) The curvature tensor is the same as the commutator (%i20) curv : ishow(v([], [j]) icurvature([j, k, l], [i])) j i i %54 i (%t20) v (- ichr2 - ichr2 ichr2 + ichr2 j l,k %54 k j l j k,l i %54 + ichr2 ichr2 ) %54 l j k (%i21) canform(comm - curv) (%o21) 0 (%i22) The function flush and relatives can drop derivative expressions (%i23) exp : u([i, k, r], [j, r]) + b([i, k], [j, r], r) + a([i], [j, r, s], k, r, s) + u([i], [j, r], k, r) (%i24) ishow(exp) j r j r j r s j r (%t24) u + b + a + u i k r i k,r i,k r s i,k r (%i25) ishow(flush(exp, u)) j r j r s j r (%t25) b + a + u i k,r i,k r s i,k r (%i26) ishow(flushd(exp, u, b)) j r j r s (%t26) u + a i k r i,k r s (%i27) ishow(flushnd(exp, a, 1)) j r j r j r (%t27) u + b + u i k r i k,r i,k r (%i28) The function lorentz() can be used to remove divergence free terms (%i29) defcon(e, e, kdelta) (%i30) defcon(e, p, p) (%i31) defcon(p, e, p) (%i32) decsym(e, 0, 2, [], [sym(all)]) (%o32) done (%i33) declare(e, constant) (%o33) done (%i34) (ratfac : false, ratvars(l), ratweight(l, 1), ratwtlvl : 1) (%o34) 1 (%i35) components(g([i, j], []), 2 l p([i, j], []) + e([i, j], [])) (%o35) done (%i36) components(g([], [i, j]), e([], [i, j]) - 2 l p([], [i, j])) (%o36) done (%i37) rinv : g([], [r, t]) icurvature([r, s, t], [s]) (%i38) ricci : g([], [i, r]) g([], [j, t]) icurvature([r, s, t], [s]) rinv g([], [i, j]) (%i39) - (ricci - ------------------) 2 (%i40) ishow(canform(rename(contract(ratexpand(ev(%)))))) %1 j %2 i %3 %2 %3 i j %1 %1 %2 j i (%t40) - e e p l + e e p l - e p l %3,%1 %2 %1,%2 %3 ,%1 %2 %1 %2 i j %1 j %2 i %1 j %2 i - p e l + e p l + p e l ,%1 %2 ,%1 %2 ,%1 %2 (%i41) ishow(lorentz_gauge(%, p)) %1 j %2 i %3 %2 %3 i j %1 %1 %2 j i (%t41) - e e p l + e e p l - e p l %3,%1 %2 %1,%2 %3 ,%1 %2 (%i42) The conmetderiv function relates derivatives of the metric tensor (%i43) ishow(q([], [a, b], c)) a b (%t43) q ,c (%i44) ishow(conmetderiv(%, q)) %69 b a %69 a b (%t44) - q ichr2 - q ichr2 %69 c %69 c INDICIAL TENSOR MANIPULATION COMPONENT TENSOR MANIPULATION 1. Basics 11. Initialization 2. Index contraction 12. Differential geometry 3. Simplification and symmetries 13. Gravitational theory 4. Special tensors 14. Frame fields 5. Coordinate differentiation 15. Torsion and nonmetricity 6. Covariant derivatives, curvature 16. Algebraic classification 7. Exterior algebra 17. Differential equations 8. Generating CTENSOR programs 18. Using Taylor series 9. Frames, torsion, nonmetricity A. Algebraic tensor manipulation E. Complete examples X. Exit this demo Select an option by its number followed by a semicolon (;) 7; batching /home/vttoth/dev/maxima/share/tensor/ex_calc.dem At the _ prompt, type ';' followed by enter to get next demo (%i1) if get('itensor, 'version) = false then load(itensor) (%o1) /home/vttoth/dev/maxima/share/tensor/itensor.lisp (%i2) Exterior algebra for fully antisymmetric covariant tensors (%i3) The exterior product is denoted by ~. Apply it to two 1-forms (%i4) ishow(a([i]) ~ b([j])) a b - b a i j i j (%t4) ------------- 2 (%i5) The exterior product of the three 1-forms (%i6) ishow(a([i]) ~ b([j]) ~ c([k])) a b c - b a c - a c b + c a b + b c a - c b a i j k i j k i j k i j k i j k i j k (%t6) --------------------------------------------------------------- 6 (%i7) Take a sum of two 3 forms (%i8) ishow(factor((ak a([i])) ~ c([j]) ~ b([k]) + a([i]) ~ (bk b([j])) ~ c([k]))) (%t8) bk a c + ak a b i k i k (%i9) declare a 2-form and compute its exterior product with a 1-form (%i10) decsym(p, 2, 0, [anti(all)], []) (%o10) done (%i11) ishow(q([i]) ~ p([j, k])) p q + q p - p q i j k i j k i k j (%t11) --------------------------- 3 (%i12) the exterior derivative by index k is denoted by extdiff(x,k) (%i13) ishow(extdiff(p([j, k]), i)) p - p + p k j,i k i,j j i,k (%t13) - ------------------------ 3 (%i14) In other words, instead of 'd_k~f' we write extdiff(f,k) (%i15) ishow(extdiff(a([j]) ~ b([k]), i)) (%t15) - (a b - b a - a b + b a - a b + a b + b a i k,j i k,j j k,i j k,i j,i k i,j k j,i k - b a - a b + b a - a b + b a )/6 i,j k i j,k i j,k i,k j i,k j (%i16) ishow(extdiff(a([j]) ~ b([k]), k)) (%t16) 0 (%i17) Contraction (interior product) with a vector v is denoted by f|v (%i18) ishow(a([i]) | a) %1 (%t18) a a %1 (%i19) ishow(a([i]) ~ b([j]) | a) %1 %1 a a b a b a %1 j %1 j (%t19) ---------- - ---------- 2 2 (%i20) This operator always uses the first index in literal order (%i21) ishow(factor(a([i1]) ~ b([i2]) | a + a([i2]) ~ b([i1]) | a)) (%t21) 0 (%i22) The Lie derivative is liediff(v,x); v is a vector name, x a tensor (%i23) ishow(liediff(v, a([i1]))) %30 %30 (%t23) v a + v a i1,%30 ,i1 %30 (%i24) The Lie-derivative works on all tensors (but not on functions) (%i25) ishow(liediff(v, a([i, j], [k, l], m))) %31 k l %31 k l l k %31 k %31 l (%t25) v a + v a - v a - v a i j,%31 m ,m i j,%31 ,%31 i j,m ,%31 i j,m %31 k l %31 k l + v a + v a ,j i %31,m ,i %31 j,m (%i26) To see all these at work, we verify the Cartan identity for 1-forms (%i27) ishow(canform(liediff(v, extdiff(a([i1]), i2)) - extdiff(liediff(v, a([i1])), i2))) (%t27) 0 (%i28) Where liediff(v,extdiff(a([i1]),i2)) evaluates to: (%i29) ishow(liediff(v, extdiff(a([i1]), i2))) %44 %44 %43 %43 (%t29) (v a + v a - v a - v a i2,%44 i1 ,i1 i2,%44 i1,%43 i2 ,i2 i1,%43 %44 %43 + v a - v a )/2 ,i2 %44,i1 ,i1 %43,i2 (%i30) Cartan identities for higher-order forms are shown in car_iden.dem INDICIAL TENSOR MANIPULATION COMPONENT TENSOR MANIPULATION 1. Basics 11. Initialization 2. Index contraction 12. Differential geometry 3. Simplification and symmetries 13. Gravitational theory 4. Special tensors 14. Frame fields 5. Coordinate differentiation 15. Torsion and nonmetricity 6. Covariant derivatives, curvature 16. Algebraic classification 7. Exterior algebra 17. Differential equations 8. Generating CTENSOR programs 18. Using Taylor series 9. Frames, torsion, nonmetricity A. Algebraic tensor manipulation E. Complete examples X. Exit this demo Select an option by its number followed by a semicolon (;) 8; batching /home/vttoth/dev/maxima/share/tensor/itensor8.dem At the _ prompt, type ';' followed by enter to get next demo (%i1) if get('itensor, 'version) = false then load(itensor) (%o1) /home/vttoth/dev/maxima/share/tensor/itensor.lisp (%i2) if get('ctensor, 'version) = false then load(ctensor) (%o2) /home/vttoth/dev/maxima/share/tensor/ctensor.mac (%i3) The RHS of the heat transport equation (%i4) dim : 3 (%o4) 3 (%i5) remcomps(g) (%o5) done (%i6) imetric(g) (%o6) done (%i7) eqn : ishow(td = source + canform(rename(expand(covdiff(- k([], []) covdiff(t([], []), i), j) g([], [i, j]))))) %1 %2 %3 %1 %2 (%t7) td = source + k t g ichr2 - t k g ,%3 %1 %2 ,%1 ,%2 %1 %2 - k t g ,%1 %2 (%i8) Convert it to a CTENSOR program (%i9) heat : ic_convert(eqn) (%o9) td : source + k sum(sum(sum(diff(t, ct_coords ) ug mcs , %3 %1, %2 %1, %2, %3 %1, 1, dim), %2, 1, dim), %3, 1, dim) - sum(sum(diff(t, ct_coords ) %1 diff(k, ct_coords ) ug , %1, 1, dim), %2, 1, dim) %2 %1, %2 - k sum(sum(diff(diff(t, ct_coords ), ct_coords ) ug , %1, 1, dim), %1 %2 %1, %2 %2, 1, dim) (%i10) Next, write the equation in Cartesian coordinates: (%i11) ct_coords : [x, y, z] (%o11) [x, y, z] (%i12) lg : ident(3) [ 1 0 0 ] [ ] (%o12) [ 0 1 0 ] [ ] [ 0 0 1 ] (%i13) ug : invert(lg) [ 1 0 0 ] [ ] (%o13) [ 0 1 0 ] [ ] [ 0 0 1 ] (%i14) christof(mcs) (%o14) done (%i15) depends([t, k], ct_coords) (%o15) [t(x, y, z), k(x, y, z)] (%i16) ev(heat) 2 2 2 d t d t d t dk dt dk dt dk dt (%o16) - k (--- + --- + ---) - -- -- - -- -- - -- -- + source 2 2 2 dz dz dy dy dx dx dz dy dx (%i17) Now get the equation in spherical coordinates. (%i18) ct_coords : [r, th, ph] (%o18) [r, th, ph] 2 2 2 (%i19) lg : matrix([1, 0, 0], [0, r , 0], [0, 0, r sin (th)]) (%i20) ug : invert(lg) (%i21) christof(all) (%t21) lcs = r 1, 2, 2 2 (%t22) lcs = r sin (th) 1, 3, 3 (%t23) lcs = - r 2, 2, 1 2 (%t24) lcs = r cos(th) sin(th) 2, 3, 3 2 (%t25) lcs = - r sin (th) 3, 3, 1 2 (%t26) lcs = - r cos(th) sin(th) 3, 3, 2 1 (%t27) mcs = - 1, 2, 2 r 1 (%t28) mcs = - 1, 3, 3 r (%t29) mcs = - r 2, 2, 1 cos(th) (%t30) mcs = ------- 2, 3, 3 sin(th) 2 (%t31) mcs = - r sin (th) 3, 3, 1 (%t32) mcs = - cos(th) sin(th) 3, 3, 2 (%o32) done (%i33) remove([t, k], dependency) (%o33) done (%i34) depends(t, ct_coords) (%o34) [t(r, th, ph)] (%i35) ev(heat) 2 2 d t d t dt dt ---- ---- --- cos(th) 2 -- 2 2 2 dth dr dph dth d t (%o35) k (- ----------- - ----) - k (----------- + ---- + ---) + source 2 r 2 2 2 2 r sin(th) r sin (th) r dr INDICIAL TENSOR MANIPULATION COMPONENT TENSOR MANIPULATION 1. Basics 11. Initialization 2. Index contraction 12. Differential geometry 3. Simplification and symmetries 13. Gravitational theory 4. Special tensors 14. Frame fields 5. Coordinate differentiation 15. Torsion and nonmetricity 6. Covariant derivatives, curvature 16. Algebraic classification 7. Exterior algebra 17. Differential equations 8. Generating CTENSOR programs 18. Using Taylor series 9. Frames, torsion, nonmetricity A. Algebraic tensor manipulation E. Complete examples X. Exit this demo Select an option by its number followed by a semicolon (;) 9; batching /home/vttoth/dev/maxima/share/tensor/itensor9.dem At the _ prompt, type ';' followed by enter to get next demo (%i1) if get('itensor, 'version) = false then load(itensor) (%o1) /home/vttoth/dev/maxima/share/tensor/itensor.lisp (%i2) In a frame base, partial derivatives do not commute (%i3) idiff(v([i], []), j, 1, k, 1) - idiff(v([i], []), k, 1, j, 1) (%o3) 0 (%i4) iframe_flag : true (%o4) true (%i5) ishow(idiff(v([i], []), j, 1, k, 1) - idiff(v([i], []), k, 1, j, 1)) (%t5) v - v i,j k i,k j (%i6) The Christoffel-symbols are replaced by connection coefficients (%i7) ishow(covdiff(v([i], []), j)) %1 (%t7) v - v icc2 i,j %1 i j (%i8) Which in turn are the sum of Christoffel-symbols and frame coefficients (%i9) ishow(icc2([i, j], [k])) k (%t9) ifc2 i j (%i10) The latter are defined in terms of the frame bracket and frame metric (%i11) ishow(ifc2([i, j], [k])) k %2 (%t11) ifg ifc1 i j %2 (%i12) The frame bracket has two definitions which are equivalent (%i13) block([iframe_bracket_form : false], ishow(ifb([i, j, k]))) %4 %3 %3 %4 (%t13) ifri (ifr ifr - ifr ifr ) i %3 j k,%4 j,%4 k (%i14) block([iframe_bracket_form : true], ishow(ifb([i, j, k]))) %5 %6 (%t14) (ifri - ifri ) ifr ifr i %5,%6 i %6,%5 j k (%i15) To explore torsion, we set up a metric but no contraction properties (%i16) remcomps(g) (%o16) done (%i17) imetric : g (%o17) g (%i18) decsym(g, 2, 0, [sym(all)], []) (%o18) done (%i19) decsym(g, 0, 2, [], [sym(all)]) (%o19) done (%i20) First demonstrate that covariant differentiation commutes for scalars (%i21) iframe_flag : false (%o21) false (%i22) itorsion_flag : false (%o22) false (%i23) inonmet_flag : false (%o23) false (%i24) ishow(covdiff(covdiff(f([], []), i), j) - covdiff(covdiff(f([], []), j), i)) %10 %8 (%t24) f ichr2 - f ichr2 ,%10 j i ,%8 i j (%i25) ishow(canform(%)) (%t25) 0 (%i26) Now we introduce torsion (%i27) itorsion_flag : true (%o27) true (%i28) ishow(covdiff(covdiff(f([], []), i), j) - covdiff(covdiff(f([], []), j), i)) %14 %12 (%t28) f icc2 - f icc2 - f + f ,%14 j i ,%12 i j ,j i ,i j (%i29) exp : ishow(canform(%)) %1 %1 (%t29) f icc2 - f icc2 ,%1 j i ,%1 i j (%i30) ishow(ev(%, icc2)) %1 %1 %1 %1 (%t30) f (ichr2 - ikt2 ) - f (ichr2 - ikt2 ) ,%1 j i j i ,%1 i j i j (%i31) ishow(canform(%)) %1 %1 (%t31) f ikt2 - f ikt2 ,%1 i j ,%1 j i (%i32) Now we're ready to evaluate the contortion coefficients (%i33) ishow(ev(exp, ikt2)) %1 %1 %16 (%t33) f (ichr2 - g ikt1 ) ,%1 j i j i %16 %1 %1 %15 - f (ichr2 - g ikt1 ) ,%1 i j i j %15 (%i34) exp : ishow(ev(%, ikt1)) %1 (%t34) f (ichr2 ,%1 j i %1 %16 %18 %18 %18 g (- g itr - itr g - itr g ) %16 %18 j i %16 i j %18 %16 j i %18 - ---------------------------------------------------------------) 2 %1 - f (ichr2 ,%1 i j %1 %15 %17 %17 %17 g (- itr g - g itr - itr g ) %15 i j %17 %15 %17 i j %15 j i %17 - ---------------------------------------------------------------) 2 (%i35) Noun forms of g are a side effect which we must get rid of (%i36) ishow(subst(g, nounify(g), exp)) %1 (%t36) f (ichr2 ,%1 j i %1 %16 %18 %18 %18 g (- g itr - itr g - itr g ) %16 %18 j i %16 i j %18 %16 j i %18 - ---------------------------------------------------------------) 2 %1 - f (ichr2 ,%1 i j %1 %15 %17 %17 %17 g (- itr g - g itr - itr g ) %15 i j %17 %15 %17 i j %15 j i %17 - ---------------------------------------------------------------) 2 (%i37) exp : ishow(canform(%)) %2 %3 %1 (%t37) - f g g itr ,%3 %1 %2 i j (%i38) We declare itr antisymmetric, and contract g^2 to kdelta (%i39) decsym(itr, 2, 1, [anti(all)], []) (%o39) done (%i40) defcon(g, g, kdelta) (%o40) done (%i41) exp : ishow(canform(exp)) %2 %3 %1 (%t41) - f g g itr ,%3 %1 %2 i j (%i42) And we're quite done (%i43) ishow(contract(exp)) %1 (%t43) - f itr ,%1 i j (%i44) We can verify torsion in a frame base, too (%i45) iframe_flag : true (%o45) true (%i46) covdiff(v([i]), j) - covdiff(v([j]), i) (%i47) ishow(contract(canform(ev(%, icc2, ifc2, ifc1, ikt2, ikt1, ifg)))) %2 %1 %2 %1 ifg v ifb ifg v ifb %2 j i %1 %2 j %1 i (%t47) ---------------------- - ---------------------- - v 2 2 j,i %2 %1 %2 %1 ifg v ifb ifg v ifb %2 i j %1 %2 i %1 j - ---------------------- + ---------------------- + v 2 2 i,j %2 %1 %2 %1 ifg ifb v ifg ifb v %1 j i %2 %1 i j %2 - ---------------------- + ---------------------- 2 2 (%i48) Next, we verify the nonmetricity tensor (%i49) iframe_flag : false (%o49) false (%i50) inonmet_flag : true (%o50) true (%i51) itorsion_flag : false (%o51) false (%i52) We need all the metric tensor's contraction properties (%i53) imetric(g) (%o53) done (%i54) ishow(covdiff(g([i, j], []), k)) %23 %23 (%t54) - g icc2 - g icc2 + g i %23 j k %23 j i k i j,k (%i55) exp : ishow(ev(%, icc2)) %23 %23 %23 %23 (%t55) - g (ichr2 - inmc2 ) - g (ichr2 - inmc2 ) + g i %23 j k j k %23 j i k i k i j,k (%i56) Now we can evaluate ichr2, inmc1, and simplify (%i57) exp : ishow(canform(contract(rename(expand(ev(exp, ichr2)))))) (%t57) inmc1 + inmc1 j k i i k j (%i58) In order to get the expected result: (%i59) ishow(canform(ev(exp, inmc1))) (%t59) - g inm i j k INDICIAL TENSOR MANIPULATION COMPONENT TENSOR MANIPULATION 1. Basics 11. Initialization 2. Index contraction 12. Differential geometry 3. Simplification and symmetries 13. Gravitational theory 4. Special tensors 14. Frame fields 5. Coordinate differentiation 15. Torsion and nonmetricity 6. Covariant derivatives, curvature 16. Algebraic classification 7. Exterior algebra 17. Differential equations 8. Generating CTENSOR programs 18. Using Taylor series 9. Frames, torsion, nonmetricity A. Algebraic tensor manipulation E. Complete examples X. Exit this demo Select an option by its number followed by a semicolon (;) 11; batching /home/vttoth/dev/maxima/share/tensor/ctensor1.dem At the _ prompt, type ';' followed by enter to get next demo (%i1) if get('ctensor, 'version) = false then load(ctensor) (%o1) /home/vttoth/dev/maxima/share/tensor/ctensor.mac (%i2) To select a stock metric, use ct_coordsys (%i3) verbose : false (%o3) false (%i4) ct_coordsys(spherical) (%o4) done (%i5) The metric tensor is stored in the array lg (%i6) lg [ 1 0 0 ] [ ] [ 2 ] (%o6) [ 0 r 0 ] [ ] [ 2 2 ] [ 0 0 r sin (theta) ] (%i7) A call to cmetric() sets up the inverse and other properties (%i8) cmetric() (%o8) done (%i9) ug [ 1 0 0 ] [ ] [ 1 ] [ 0 -- 0 ] [ 2 ] (%o9) [ r ] [ ] [ 1 ] [ 0 0 -------------- ] [ 2 2 ] [ r sin (theta) ] (%i10) diagmetric (%o10) true (%i11) Most metrics are available also as a frame base (%i12) cframe_flag : true (%o12) true (%i13) ct_coordsys(spherical) (%o13) done (%i14) The inverse frame base is in the array fri; lfg is the frame metric (%i15) fri [ 1 0 0 ] [ ] (%o15) [ 0 r 0 ] [ ] [ 0 0 r sin(theta) ] (%i16) lfg [ 1 0 0 ] [ ] (%o16) [ 0 1 0 ] [ ] [ 0 0 1 ] (%i17) Now, cmetric computes the frame base, and also the metric (%i18) cmetric() (%o18) false (%i19) fr [ 1 0 0 ] [ ] [ 1 ] [ 0 - 0 ] (%o19) [ r ] [ ] [ 1 ] [ 0 0 ------------ ] [ r sin(theta) ] (%i20) ufg [ 1 0 0 ] [ ] (%o20) [ 0 1 0 ] [ ] [ 0 0 1 ] (%i21) lg [ 1 0 0 ] [ ] [ 2 ] (%o21) [ 0 r 0 ] [ ] [ 2 2 ] [ 0 0 r sin (theta) ] (%i22) You can also supply a set of transformation rules to ct_coordsys (%i23) ct_coordsys([r cos(theta) cos(phi), r cos(theta) sin(phi), r sin(theta), [r, theta, phi]]) (%o23) done (%i24) cmetric() (%o24) false (%i25) fri (%o25) [ cos(phi) cos(theta) - cos(phi) r sin(theta) - sin(phi) r cos(theta) ] [ ] [ sin(phi) cos(theta) - sin(phi) r sin(theta) cos(phi) r cos(theta) ] [ ] [ sin(theta) r cos(theta) 0 ] (%i26) lg : trigsimp(lg) [ 1 0 0 ] [ ] [ 2 ] (%o26) [ 0 r 0 ] [ ] [ 2 2 ] [ 0 0 r cos (theta) ] INDICIAL TENSOR MANIPULATION COMPONENT TENSOR MANIPULATION 1. Basics 11. Initialization 2. Index contraction 12. Differential geometry 3. Simplification and symmetries 13. Gravitational theory 4. Special tensors 14. Frame fields 5. Coordinate differentiation 15. Torsion and nonmetricity 6. Covariant derivatives, curvature 16. Algebraic classification 7. Exterior algebra 17. Differential equations 8. Generating CTENSOR programs 18. Using Taylor series 9. Frames, torsion, nonmetricity A. Algebraic tensor manipulation E. Complete examples X. Exit this demo Select an option by its number followed by a semicolon (;) 12; batching /home/vttoth/dev/maxima/share/tensor/ctensor2.dem At the _ prompt, type ';' followed by enter to get next demo (%i1) if get('ctensor, 'version) = false then load(ctensor) (%o1) /home/vttoth/dev/maxima/share/tensor/ctensor.mac (%i2) Prove that the Schwarzschild line element is of an empty metric (%i3) The dimension of the manifold (%i4) dim : 4 (%o4) 4 (%i5) The coordinate labels (%i6) ct_coords : [x, y, z, t] (%o6) [x, y, z, t] (%i7) Rational simplification of geometrical objects (%i8) (ratwtlvl : false, ratfac : true) (%o8) true (%i9) Here is the Schwarzschild metric in standard coordinates: 1 2 2 2 (%i10) lg : matrix([-------, 0, 0, 0], [0, x , 0, 0], [0, 0, x sin (y), 0], 2 m 1 - --- x 2 m [0, 0, 0, --- - 1]) x [ 1 ] [ ------- 0 0 0 ] [ 2 m ] [ 1 - --- ] [ x ] [ ] [ 2 ] (%o10) [ 0 x 0 0 ] [ ] [ 2 2 ] [ 0 0 x sin (y) 0 ] [ ] [ 2 m ] [ 0 0 0 --- - 1 ] [ x ] (%i11) Compute metric inverse and determine diagonality (%i12) cmetric() (%o12) done (%i13) Compute and display mixed Christoffel symbols (%i14) christof(mcs) m (%t14) mcs = - ----------- 1, 1, 1 x (x - 2 m) 1 (%t15) mcs = - 1, 2, 2 x 1 (%t16) mcs = - 1, 3, 3 x m (%t17) mcs = ----------- 1, 4, 4 x (x - 2 m) (%t18) mcs = 2 m - x 2, 2, 1 cos(y) (%t19) mcs = ------ 2, 3, 3 sin(y) 2 (%t20) mcs = - (x - 2 m) sin (y) 3, 3, 1 (%t21) mcs = - cos(y) sin(y) 3, 3, 2 m (x - 2 m) (%t22) mcs = ----------- 4, 4, 1 3 x (%o22) done (%i23) Compute and rationally simplify the contravariant Ricci tensor (%i24) uricci(true) THIS SPACETIME IS EMPTY AND/OR FLAT (%o24) done (%i25) Computes scalar curvature (%i26) scurvature() (%o26) 0 (%i27) Compute the (3,1) Riemann tensor (%i28) riemann(true) m (%t28) riem = ------------ 1, 2, 1, 2 2 x (x - 2 m) m (%t29) riem = ------------ 1, 3, 1, 3 2 x (x - 2 m) 2 m m 2 m (%t30) riem = - ------------ - ------------ + ------------- 1, 4, 1, 4 2 2 2 2 x (x - 2 m) x (x - 2 m) x (x - 2 m) m (%t31) riem = - - 2, 2, 1, 1 x 2 m - x (%t32) riem = - ------- - 1 2, 3, 2, 3 x m (2 m - x) (%t33) riem = - ----------- 2, 4, 2, 4 x (x - 2 m) 2 m sin (y) (%t34) riem = - --------- 3, 3, 1, 1 x 2 2 m sin (y) (%t35) riem = ----------- 3, 3, 2, 2 x 2 m sin (y) (%t36) riem = --------- 3, 4, 3, 4 x 2 m (x - 2 m) (%t37) riem = - ------------- 4, 4, 1, 1 4 x m (x - 2 m) (%t38) riem = ----------- 4, 4, 2, 2 4 x m (x - 2 m) (%t39) riem = ----------- 4, 4, 3, 3 4 x (%o39) done (%i40) Compute the covariant Riemann tensor (%i41) lriemann(true) m (%t41) lriem = - ------- 2, 2, 1, 1 x - 2 m 2 m sin (y) (%t42) lriem = - --------- 3, 3, 1, 1 x - 2 m 2 (%t43) lriem = 2 m x sin (y) 3, 3, 2, 2 2 m (%t44) lriem = - --- 4, 4, 1, 1 3 x m (x - 2 m) (%t45) lriem = ----------- 4, 4, 2, 2 2 x 2 m (x - 2 m) sin (y) (%t46) lriem = ------------------- 4, 4, 3, 3 2 x (%o46) done (%i47) Compute the contravariant Riemann tensor (%i48) uriemann(true) m (x - 2 m) (%t48) uriem = - ----------- 2, 2, 1, 1 6 x m (x - 2 m) (%t49) uriem = - ----------- 3, 3, 1, 1 6 2 x sin (y) 2 m (%t50) uriem = ---------- 3, 3, 2, 2 7 2 x sin (y) 2 m (%t51) uriem = - --- 4, 4, 1, 1 3 x m (%t52) uriem = ------------ 4, 4, 2, 2 4 x (x - 2 m) m (%t53) uriem = -------------------- 4, 4, 3, 3 4 2 x (x - 2 m) sin (y) (%o53) done (%i54) Compute the Kretchmann invariant Rijkl^2 (%i55) rinvariant() 2 48 m (%o55) ----- 6 x INDICIAL TENSOR MANIPULATION COMPONENT TENSOR MANIPULATION 1. Basics 11. Initialization 2. Index contraction 12. Differential geometry 3. Simplification and symmetries 13. Gravitational theory 4. Special tensors 14. Frame fields 5. Coordinate differentiation 15. Torsion and nonmetricity 6. Covariant derivatives, curvature 16. Algebraic classification 7. Exterior algebra 17. Differential equations 8. Generating CTENSOR programs 18. Using Taylor series 9. Frames, torsion, nonmetricity A. Algebraic tensor manipulation E. Complete examples X. Exit this demo Select an option by its number followed by a semicolon (;) 13; batching /home/vttoth/dev/maxima/share/tensor/ctensor3.dem At the _ prompt, type ';' followed by enter to get next demo (%i1) if get('ctensor, 'version) = false then load(ctensor) (%o1) /home/vttoth/dev/maxima/share/tensor/ctensor.mac (%i2) A conformally flat metric helps demonstrate the curvature tensors (%i3) (ratwtlvl : false, ratfac : true) (%o3) true (%i4) derivabbrev : true (%o4) true (%i5) dim : 4 (%o5) 4 (%i6) ct_coords : [x, y, z, t] (%o6) [x, y, z, t] (%i7) lg : a ident(4) [ a 0 0 0 ] [ ] [ 0 a 0 0 ] (%o7) [ ] [ 0 0 a 0 ] [ ] [ 0 0 0 a ] (%i8) dependencies(a(t)) (%o8) [a(t)] (%i9) cmetric() computes the metric inverse: (%i10) cmetric() (%o10) done (%i11) ug [ 1 ] [ - 0 0 0 ] [ a ] [ ] [ 1 ] [ 0 - 0 0 ] [ a ] (%o11) [ ] [ 1 ] [ 0 0 - 0 ] [ a ] [ ] [ 1 ] [ 0 0 0 - ] [ a ] (%i12) christof() computes the Christoffel-symbols of the 1st and 2nd kind (%i13) christof(mcs) a t (%t13) mcs = - --- 1, 1, 4 2 a a t (%t14) mcs = --- 1, 4, 1 2 a a t (%t15) mcs = - --- 2, 2, 4 2 a a t (%t16) mcs = --- 2, 4, 2 2 a a t (%t17) mcs = - --- 3, 3, 4 2 a a t (%t18) mcs = --- 3, 4, 3 2 a a t (%t19) mcs = --- 4, 4, 4 2 a (%o19) done (%i20) ricci() computes and optionally displays the mixed-index Ricci tensor (%i21) ricci(true) a t t (%t21) ric = - ---- 1, 1 2 a a t t (%t22) ric = - ---- 2, 2 2 a a t t (%t23) ric = - ---- 3, 3 2 a 2 3 (a a - (a ) ) t t t (%t24) ric = - ------------------ 4, 4 2 2 a (%o24) done (%i25) uricci() computes the contravariant Ricci tensor (%i26) uricci(true) a t t (%t26) uric = - ---- 1, 1 2 2 a a t t (%t27) uric = - ---- 2, 2 2 2 a a t t (%t28) uric = - ---- 3, 3 2 2 a 2 3 (a a - (a ) ) t t t (%t29) uric = - ------------------ 4, 4 3 2 a (%o29) done (%i30) riemann() computes the (3,1) Riemann-tensor (%i31) riemann(true) 2 (a ) t (%t31) riem = ----- 1, 2, 1, 2 2 4 a 2 (a ) t (%t32) riem = ----- 1, 3, 1, 3 2 4 a 2 a (a ) t t t (%t33) riem = ---- - ----- 1, 4, 1, 4 2 a 2 2 a 2 (a ) t (%t34) riem = - ----- 2, 2, 1, 1 2 4 a 2 (a ) t (%t35) riem = ----- 2, 3, 2, 3 2 4 a 2 a (a ) t t t (%t36) riem = ---- - ----- 2, 4, 2, 4 2 a 2 2 a 2 (a ) t (%t37) riem = - ----- 3, 3, 1, 1 2 4 a 2 (a ) t (%t38) riem = - ----- 3, 3, 2, 2 2 4 a 2 a (a ) t t t (%t39) riem = ---- - ----- 3, 4, 3, 4 2 a 2 2 a 2 a a - (a ) t t t (%t40) riem = - -------------- 4, 4, 1, 1 2 2 a 2 a a - (a ) t t t (%t41) riem = - -------------- 4, 4, 2, 2 2 2 a 2 a a - (a ) t t t (%t42) riem = - -------------- 4, 4, 3, 3 2 2 a (%o42) done (%i43) The covariant Riemann-tensor is obtained with lriemann() (%i44) lriemann(true) 2 (a ) t (%t44) lriem = - ----- 2, 2, 1, 1 4 a 2 (a ) t (%t45) lriem = - ----- 3, 3, 1, 1 4 a 2 (a ) t (%t46) lriem = - ----- 3, 3, 2, 2 4 a 2 a a - (a ) t t t (%t47) lriem = - -------------- 4, 4, 1, 1 2 a 2 a a - (a ) t t t (%t48) lriem = - -------------- 4, 4, 2, 2 2 a 2 a a - (a ) t t t (%t49) lriem = - -------------- 4, 4, 3, 3 2 a (%o49) done (%i50) While uriemann() computes the contravariant Riemann tensor (%i51) uriemann(true) 2 (a ) t (%t51) uriem = - ----- 2, 2, 1, 1 5 4 a 2 (a ) t (%t52) uriem = - ----- 3, 3, 1, 1 5 4 a 2 (a ) t (%t53) uriem = - ----- 3, 3, 2, 2 5 4 a 2 a a - (a ) t t t (%t54) uriem = - -------------- 4, 4, 1, 1 5 2 a 2 a a - (a ) t t t (%t55) uriem = - -------------- 4, 4, 2, 2 5 2 a 2 a a - (a ) t t t (%t56) uriem = - -------------- 4, 4, 3, 3 5 2 a (%o56) done (%i57) The mixed-index Einstein tensor is computed by einstein() (%i58) einstein(true) 2 4 a a - 3 (a ) t t t (%t58) ein = ------------------ 1, 1 3 4 a 2 4 a a - 3 (a ) t t t (%t59) ein = ------------------ 2, 2 3 4 a 2 4 a a - 3 (a ) t t t (%t60) ein = ------------------ 3, 3 3 4 a 2 3 (a ) t (%t61) ein = ------- 4, 4 3 4 a (%o61) done (%i62) The covariant Einstein tensor is computed by leinstein() (%i63) leinstein(true) 2 4 a a - 3 (a ) t t t (%t63) lein = ------------------ 1, 1 2 4 a 2 4 a a - 3 (a ) t t t (%t64) lein = ------------------ 2, 2 2 4 a 2 4 a a - 3 (a ) t t t (%t65) lein = ------------------ 3, 3 2 4 a 2 3 (a ) t (%t66) lein = ------- 4, 4 2 4 a (%o66) done (%i67) Rinvariant obtains the Kretchmann-invariant: (%i68) rinvariant() 2 2 4 3 (a a - (a ) ) 3 (a ) t t t t (%o68) ------------------- + ------- 6 6 a 4 a (%i69) The Weyl tensor is empty for a conformally metric (%i70) weyl(true) THIS SPACETIME IS CONFORMALLY FLAT (%o70) done INDICIAL TENSOR MANIPULATION COMPONENT TENSOR MANIPULATION 1. Basics 11. Initialization 2. Index contraction 12. Differential geometry 3. Simplification and symmetries 13. Gravitational theory 4. Special tensors 14. Frame fields 5. Coordinate differentiation 15. Torsion and nonmetricity 6. Covariant derivatives, curvature 16. Algebraic classification 7. Exterior algebra 17. Differential equations 8. Generating CTENSOR programs 18. Using Taylor series 9. Frames, torsion, nonmetricity A. Algebraic tensor manipulation E. Complete examples X. Exit this demo Select an option by its number followed by a semicolon (;) 14; batching /home/vttoth/dev/maxima/share/tensor/ctensor4.dem At the _ prompt, type ';' followed by enter to get next demo (%i1) if get('ctensor, 'version) = false then load(ctensor) (%o1) /home/vttoth/dev/maxima/share/tensor/ctensor.mac (%i2) Verify the Schwarzschild metric in tetrad base (%i3) The variable cframe_flag determines if a frame base is used (%i4) cframe_flag : true (%o4) true (%i5) ct_coordsys() can be used to set up predefined metrics (%i6) verbose : true (%o6) true (%i7) ct_coordsys(exteriorschwarzschild) (%t7) dim = 4 (%t8) ct_coords = [t, r, theta, phi] [ - 1 0 0 0 ] [ ] [ 0 1 0 0 ] (%t9) lfg = [ ] [ 0 0 1 0 ] [ ] [ 0 0 0 1 ] [ sqrt(r - 2 m) ] [ ------------- 0 0 0 ] [ sqrt(r) ] [ ] [ sqrt(r) ] (%t10) fri = [ 0 ------------- 0 0 ] [ sqrt(r - 2 m) ] [ ] [ 0 0 r 0 ] [ ] [ 0 0 0 r sin(theta) ] (%o10) done (%i11) A call to cmetric() computes the frame base and the metric (%i12) cmetric() (%i13) fr [ sqrt(r) ] [ - ------------- 0 0 0 ] [ sqrt(r - 2 m) ] [ ] [ sqrt(r - 2 m) ] [ 0 ------------- 0 0 ] [ sqrt(r) ] (%o13) [ ] [ 1 ] [ 0 0 - 0 ] [ r ] [ ] [ 1 ] [ 0 0 0 ------------ ] [ r sin(theta) ] (%i14) lg [ r - 2 m ] [ - ------- 0 0 0 ] [ r ] [ ] [ r ] [ 0 ------- 0 0 ] (%o14) [ r - 2 m ] [ ] [ 2 ] [ 0 0 r 0 ] [ ] [ 2 2 ] [ 0 0 0 r sin (theta) ] (%i15) But we're not using the metric when we compute the connection (%i16) christof(mcs) m (%t16) mcs = - ------------------ 1, 1, 2 3/2 r sqrt(r - 2 m) m (%t17) mcs = - ------------------ 1, 2, 1 3/2 r sqrt(r - 2 m) sqrt(r - 2 m) (%t18) mcs = ------------- 3, 3, 2 3/2 r sqrt(r - 2 m) (%t19) mcs = ------------- 4, 4, 2 3/2 r cos(theta) (%t20) mcs = ------------ 4, 4, 3 r sin(theta) (%o20) done (%i21) We can now compute the Ricci tensor in tetrad base (%i22) ricci(true) THIS SPACETIME IS EMPTY AND/OR FLAT (%o22) done INDICIAL TENSOR MANIPULATION COMPONENT TENSOR MANIPULATION 1. Basics 11. Initialization 2. Index contraction 12. Differential geometry 3. Simplification and symmetries 13. Gravitational theory 4. Special tensors 14. Frame fields 5. Coordinate differentiation 15. Torsion and nonmetricity 6. Covariant derivatives, curvature 16. Algebraic classification 7. Exterior algebra 17. Differential equations 8. Generating CTENSOR programs 18. Using Taylor series 9. Frames, torsion, nonmetricity A. Algebraic tensor manipulation E. Complete examples X. Exit this demo Select an option by its number followed by a semicolon (;) 15; batching /home/vttoth/dev/maxima/share/tensor/ctensor5.dem At the _ prompt, type ';' followed by enter to get next demo (%i1) if get('ctensor, 'version) = false then load(ctensor) (%o1) /home/vttoth/dev/maxima/share/tensor/ctensor.mac (%i2) We use a simple 2D metric to demonstrate torsion and nonmetricity (%i3) ct_coordsys(cartesian2d) (%t3) dim = 2 (%t4) ct_coords = [x, y] [ 1 0 ] (%t5) lg = [ ] [ 0 1 ] (%o5) done (%i6) ug : invert(lg) [ 1 0 ] (%o6) [ ] [ 0 1 ] (%i7) In a flat metric, the Christoffel symbols are zero (%i8) christof(false) (%o8) done (%i9) cdisplay(mcs) [ 0 0 ] mcs = [ ] 1 [ 0 0 ] [ 0 0 ] mcs = [ ] 2 [ 0 0 ] (%o9) done (%i10) Let us examine how torsion changes this (%i11) ctorsion_flag : true (%o11) true (%i12) christof(false) (%o12) done (%i13) cdisplay(mcs) [ 3 tr - 2 tr - tr ] [ 1, 1, 1 2, 1, 1 1, 1, 2 ] [ ----------- - ------------------------- ] [ 2 2 ] mcs = [ ] 1 [ - 2 tr - tr - tr - tr - tr ] [ 1, 2, 1 1, 1, 2 2, 2, 1 2, 1, 2 1, 2, 2 ] [ - ------------------------- - ----------------------------------- ] [ 2 2 ] [ - tr - tr - tr - tr - 2 tr ] [ 2, 1, 1 1, 2, 1 1, 1, 2 2, 2, 1 2, 1, 2 ] [ - ----------------------------------- - ------------------------- ] [ 2 2 ] mcs = [ ] 2 [ - tr - 2 tr 3 tr ] [ 2, 2, 1 1, 2, 2 2, 2, 2 ] [ - ------------------------- ----------- ] [ 2 2 ] (%o13) done (%i14) And now recalculate the Christoffel symbols with nonmetricity (%i15) ctorsion_flag : false (%o15) false (%i16) cnonmet_flag : true (%o16) true (%i17) christof(false) (%o17) done (%i18) cdisplay(mcs) [ nm - nm ] [ 1 2 ] mcs = [ ] 1 [ nm nm ] [ 2 1 ] [ nm nm ] [ 2 1 ] mcs = [ ] 2 [ - nm nm ] [ 1 2 ] (%o18) done (%i19) The arrays tr and nm are user-defined. INDICIAL TENSOR MANIPULATION COMPONENT TENSOR MANIPULATION 1. Basics 11. Initialization 2. Index contraction 12. Differential geometry 3. Simplification and symmetries 13. Gravitational theory 4. Special tensors 14. Frame fields 5. Coordinate differentiation 15. Torsion and nonmetricity 6. Covariant derivatives, curvature 16. Algebraic classification 7. Exterior algebra 17. Differential equations 8. Generating CTENSOR programs 18. Using Taylor series 9. Frames, torsion, nonmetricity A. Algebraic tensor manipulation E. Complete examples X. Exit this demo Select an option by its number followed by a semicolon (;) 16; batching /home/vttoth/dev/maxima/share/tensor/ctensor6.dem At the _ prompt, type ';' followed by enter to get next demo (%i1) if get('ctensor, 'version) = false then load(ctensor) (%o1) /home/vttoth/dev/maxima/share/tensor/ctensor.mac (%i2) Computing the Petrov classification of the Schwarzschild metric (%i3) We use frames, set up simplification flags (%i4) (cframe_flag : true, gcd : spmod, ctrgsimp : true, ratwtlvl : false, ratfac : true) (%o4) true (%i5) We use the stock Schwarzschild frame (%i6) ct_coordsys(exteriorschwarzschild, all) (%t6) dim = 4 (%t7) ct_coords = [t, r, theta, phi] [ - 1 0 0 0 ] [ ] [ 0 1 0 0 ] (%t8) lfg = [ ] [ 0 0 1 0 ] [ ] [ 0 0 0 1 ] [ sqrt(r - 2 m) ] [ ------------- 0 0 0 ] [ sqrt(r) ] [ ] [ sqrt(r) ] (%t9) fri = [ 0 ------------- 0 0 ] [ sqrt(r - 2 m) ] [ ] [ 0 0 r 0 ] [ ] [ 0 0 0 r sin(theta) ] (%o9) done (%i10) The inverse metric tensor is needed by nptetrad() (%i11) ug : invert(lg) (%i12) The basis for the calculations is the Weyl tensor (%i13) weyl(false) (%o13) done (%i14) We compute a Newman-Penrose null tetrad (%i15) nptetrad(false) (%o15) done (%i16) Now we're ready to compute the coefficients (%i17) psi(true) (%t17) psi = 0 0 (%t18) psi = 0 1 m (%t19) psi = -- 2 3 r (%t20) psi = 0 3 (%t21) psi = 0 4 (%o21) done (%i22) And obtain the Petrov class (%i23) petrov() (%o23) D INDICIAL TENSOR MANIPULATION COMPONENT TENSOR MANIPULATION 1. Basics 11. Initialization 2. Index contraction 12. Differential geometry 3. Simplification and symmetries 13. Gravitational theory 4. Special tensors 14. Frame fields 5. Coordinate differentiation 15. Torsion and nonmetricity 6. Covariant derivatives, curvature 16. Algebraic classification 7. Exterior algebra 17. Differential equations 8. Generating CTENSOR programs 18. Using Taylor series 9. Frames, torsion, nonmetricity A. Algebraic tensor manipulation E. Complete examples X. Exit this demo Select an option by its number followed by a semicolon (;) 17; batching /home/vttoth/dev/maxima/share/tensor/ctensor7.dem At the _ prompt, type ';' followed by enter to get next demo (%i1) if get('ctensor, 'version) = false then load(ctensor) (%o1) /home/vttoth/dev/maxima/share/tensor/ctensor.mac (%i2) We set up a simple nonempty metric (%i3) derivabbrev : true (%o3) true (%i4) dim : 4 (%o4) 4 2 2 2 (%i5) lg : matrix([a, 0, 0, 0], [0, x , 0, 0], [0, 0, x sin (y), 0], [0, 0, 0, - d]) [ a 0 0 0 ] [ ] [ 2 ] [ 0 x 0 0 ] (%o5) [ ] [ 2 2 ] [ 0 0 x sin (y) 0 ] [ ] [ 0 0 0 - d ] (%i6) depends([a, d], x) (%o6) [a(x), d(x)] (%i7) ct_coords : [x, y, z, t] (%o7) [x, y, z, t] (%i8) Compute the inverse metric (%i9) cmetric() (%o9) done (%i10) Compute the Einstein tensor (%i11) einstein(false) (%o11) done (%i12) Find a set of unique differential equations in ein (%i13) findde(ein, 2) 2 (%o13) [d x - a d + d, 2 a d d x - a (d ) x - a d d x + 2 a d d x x x x x x x 2 2 - 2 a d , a x + a - a] x x (%i14) Find out which tensor components were used in these equations (%i15) deindex (%o15) [[1, 1], [2, 2], [4, 4]] INDICIAL TENSOR MANIPULATION COMPONENT TENSOR MANIPULATION 1. Basics 11. Initialization 2. Index contraction 12. Differential geometry 3. Simplification and symmetries 13. Gravitational theory 4. Special tensors 14. Frame fields 5. Coordinate differentiation 15. Torsion and nonmetricity 6. Covariant derivatives, curvature 16. Algebraic classification 7. Exterior algebra 17. Differential equations 8. Generating CTENSOR programs 18. Using Taylor series 9. Frames, torsion, nonmetricity A. Algebraic tensor manipulation E. Complete examples X. Exit this demo Select an option by its number followed by a semicolon (;) 18; batching /home/vttoth/dev/maxima/share/tensor/ctensor8.dem At the _ prompt, type ';' followed by enter to get next demo (%i1) Define a metric that is a perturbation of the Minkowski metric (%i2) if get('ctensor, 'version) = false then load(ctensor) (%o2) /home/vttoth/dev/maxima/share/tensor/ctensor.mac (%i3) ratfac : true (%o3) true (%i4) derivabbrev : true (%o4) true (%i5) ct_coords : [t, r, theta, phi] (%o5) [t, r, theta, phi] 2 (%i6) lg : matrix([- 1, 0, 0, 0], [0, 1, 0, 0], [0, 0, r , 0], 2 2 [0, 0, 0, r sin (theta)]) [ - 1 0 0 0 ] [ ] [ 0 1 0 0 ] [ ] (%o6) [ 2 ] [ 0 0 r 0 ] [ ] [ 2 2 ] [ 0 0 0 r sin (theta) ] (%i7) h : matrix([h11, 0, 0, 0], [0, h22, 0, 0], [0, 0, h33, 0], [0, 0, 0, h44]) [ h11 0 0 0 ] [ ] [ 0 h22 0 0 ] (%o7) [ ] [ 0 0 h33 0 ] [ ] [ 0 0 0 h44 ] (%i8) Spherically symmetric metric depends on the scalar field l (%i9) depends(l, r) (%o9) [l(r)] (%i10) lg : l h + lg [ h11 l - 1 0 0 0 ] [ ] [ 0 h22 l + 1 0 0 ] [ ] (%o10) [ 2 ] [ 0 0 r + h33 l 0 ] [ ] [ 2 2 ] [ 0 0 0 r sin (theta) + h44 l ] (%i11) First, we compute the Einstein tensor (%i12) cmetric(false) (%o12) done (%i13) Be patient, this will take a while... (%i14) einstein(false) (%o14) done (%i15) And it has far too many terms (%i16) ntermst(ein) [[1, 1], 62] [[1, 2], 0] [[1, 3], 0] [[1, 4], 0] [[2, 1], 0] [[2, 2], 24] [[2, 3], 6] [[2, 4], 0] [[3, 1], 0] [[3, 2], 6] [[3, 3], 46] [[3, 4], 0] [[4, 1], 0] [[4, 2], 0] [[4, 3], 0] [[4, 4], 46] (%o16) done (%i17) Now let's drop terms higher order in l (%i18) ctayswitch : true (%o18) true (%i19) ctayvar : l (%o19) l (%i20) ctaypov : 1 (%o20) 1 (%i21) ctaypt : 0 (%o21) 0 (%i22) We now explicitly recompute the Christoffel symbols and the Ricci tensor (%i23) christof(false) (%o23) done (%i24) ricci(false) (%o24) done (%i25) So that we can recompute the Einstein tensor (%i26) einstein(false) (%o26) done (%i27) Which now has far fewer terms: (%i28) ntermst(ein) [[1, 1], 5] [[1, 2], 0] [[1, 3], 0] [[1, 4], 0] [[2, 1], 0] [[2, 2], 13] [[2, 3], 2] [[2, 4], 0] [[3, 1], 0] [[3, 2], 2] [[3, 3], 9] [[3, 4], 0] [[4, 1], 0] [[4, 2], 0] [[4, 3], 0] [[4, 4], 9] (%o28) done (%i29) The truncated terms are small enough for display (%i30) for i thru dim do (ein : ratsimp(ein ), ldisplay(ein )) i, i i, i i, i 2 2 4 2 2 (%t30) ein = - (((h11 h22 - h11 ) (l ) r - 2 h33 l r ) sin (theta) 1, 1 r r r 2 2 4 2 - 2 h44 l r - h33 h44 (l ) )/(4 r sin (theta)) r r r 2 4 3 (%t31) ein = - (l (((h11 h22 - h11 ) l r + (4 h11 - 4 h22) r 2, 2 r r 2 2 4 + (h11 - h22) h33 l r - 4 h33 r - h33 l ) sin (theta) r r 2 2 2 + ((h11 - h22) h44 l r - 4 h44 r - h33 h44 l ) sin (theta) - h44 l )) r r r 4 4 /(4 r sin (theta)) 4 3 2 2 (%t32) ein = - ((2 h11 l r + (2 h11 - 2 h22) l r - h22 h33 (l ) r 3, 3 r r r r 2 2 2 2 2 - 2 h33 l r - h33 (l ) ) sin (theta) + (h11 h44 (l ) - 2 h44 l ) r r r r r r 4 2 + 2 h44 l r)/(4 r sin (theta)) r 4 3 (%t33) ein = - ((2 h11 l r + (2 h11 - 2 h22) l r 4, 4 r r r 2 2 4 + (h11 h33 (l ) - 2 h33 l ) r + 2 h33 l r) sin (theta) r r r r 2 2 2 2 2 + (- h22 h44 (l ) r - 2 h44 l r) sin (theta) - h44 (l ) ) r r r 4 4 /(4 r sin (theta)) (%o33) done INDICIAL TENSOR MANIPULATION COMPONENT TENSOR MANIPULATION 1. Basics 11. Initialization 2. Index contraction 12. Differential geometry 3. Simplification and symmetries 13. Gravitational theory 4. Special tensors 14. Frame fields 5. Coordinate differentiation 15. Torsion and nonmetricity 6. Covariant derivatives, curvature 16. Algebraic classification 7. Exterior algebra 17. Differential equations 8. Generating CTENSOR programs 18. Using Taylor series 9. Frames, torsion, nonmetricity A. Algebraic tensor manipulation E. Complete examples X. Exit this demo Select an option by its number followed by a semicolon (;) a; batching /home/vttoth/dev/maxima/share/tensor/atensor.dem At the _ prompt, type ';' followed by enter to get next demo (%i1) if get('atensor, 'version) = false then load(atensor) (%o1) /home/vttoth/dev/maxima/share/tensor/atensor.mac (%i2) ATENSOR can simplify noncommutative products in various algebras. (%i3) Let us begin with a Clifford algebra (%i4) init_atensor(clifford) (%o4) done (%i5) atensimp(u . u) (%o5) sf(u, u) (%i6) atensimp(u . v - v . u) (%o6) 2 (u . v) - 2 sf(u, v) (%i7) Here is the symplectic algebra (%i8) init_atensor(symplectic) (%o8) done (%i9) atensimp(v . u + u . v) (%o9) 2 (u . v) - 2 af(u, v) (%i10) The function af is an antisymmetric scalar-valued function. (%i11) atensimp(w . (u . v)) (%o11) - 2 u af(v, w) - 2 af(u, w) v + u . v . w (%i12) A Clifford algebra of positive dimension 3 is defined as (%i13) init_atensor(clifford, 3) (%o13) done (%i14) The symbol used for base vectors is stored in asymbol (%i15) asymbol (%o15) v (%i16) atensimp(v . v ) 1 1 (%o16) 1 (%i17) ATENSOR knows about predefined algebras, such as quaternions (%i18) init_atensor(quaternion) (%o18) done (%i19) Quaternions are defined as a Clifford algebra of 2 negative dimensions (%i20) adim (%o20) 2 (%i21) The antisymmetric function af() takes its values from the matrix aform (%i22) aform [ - 1 0 ] (%o22) [ ] [ 0 - 1 ] (%i23) Quaternionic units are v[1], v[2], and v[1].v[2] (%i24) atensimp(v . v ) 1 1 (%o24) - 1 (%i25) atensimp(v . v ) 2 2 (%o25) - 1 (%i26) atensimp((v . v ) . (v . v )) 1 2 1 2 (%o26) - 1 (%i27) We can even construct the quaternionic multiplication table: (%i28) q : zeromatrix(4, 4) [ 0 0 0 0 ] [ ] [ 0 0 0 0 ] (%o28) [ ] [ 0 0 0 0 ] [ ] [ 0 0 0 0 ] (%i29) q : 1 1, 1 (%o29) 1 (%i30) for i thru adim do q : q : v 1, 1 + i 1 + i, 1 i (%o30) done (%i31) q : q : v . v 1, 4 4, 1 1 2 (%o31) v . v 1 2 (%i32) for i from 2 thru 4 do (for j from 2 thru 4 do q : atensimp(q . q )) i, j i, 1 1, j (%o32) done (%i33) q [ 1 v v v . v ] [ 1 2 1 2 ] [ ] [ v - 1 v . v - v ] [ 1 1 2 2 ] (%o33) [ ] [ v - v . v - 1 v ] [ 2 1 2 1 ] [ ] [ v . v v - v - 1 ] [ 1 2 2 1 ] (%i34) Scalar variables are treated appropriately (%i35) declare([a, b], scalar) (%o35) done (%i36) atensimp((b (v . v ) + a) . (v . v )) 1 2 1 2 (%o36) (v . v ) a - b 1 2 (%i37) Verify the Jacobi-identity for Lie algebras (%i38) init_atensor(lie_envelop) (%o38) done (%i39) Let's define the Lie-bracket (%i40) lbr(u, v) := u . v - v . u (%o40) lbr(u, v) := u . v - v . u (%i41) atensimp(lbr(u, lbr(v, w))) (%o41) 2 (u . av(v, w)) - 2 (u . av(v, w) - 2 av(u, av(v, w))) (%i42) atensimp(lbr(v, lbr(w, u))) (%o42) 2 (av(u, w) . v) - 2 (av(u, w) . v - 2 av(av(u, w), v)) (%i43) atensimp(lbr(w, lbr(u, v))) (%o43) 2 (av(u, w) . v - 2 av(av(u, w), v)) - 2 (av(u, w) . v) + 2 (u . av(v, w) - 2 av(u, av(v, w))) - 2 (u . av(v, w)) (%i44) %th(1) + %th(2) + %th(3) (%o44) 0 INDICIAL TENSOR MANIPULATION COMPONENT TENSOR MANIPULATION 1. Basics 11. Initialization 2. Index contraction 12. Differential geometry 3. Simplification and symmetries 13. Gravitational theory 4. Special tensors 14. Frame fields 5. Coordinate differentiation 15. Torsion and nonmetricity 6. Covariant derivatives, curvature 16. Algebraic classification 7. Exterior algebra 17. Differential equations 8. Generating CTENSOR programs 18. Using Taylor series 9. Frames, torsion, nonmetricity A. Algebraic tensor manipulation E. Complete examples X. Exit this demo Select an option by its number followed by a semicolon (;) e; The following specific examples demonstrate practical applications: INDICIAL TENSOR MANIPULATION COMPONENT TENSOR MANIPULATION 1. Proving the Bianchi-identities 11. Deriving Schwarzschild's metric 2. Proving Cartan's identities 12. Verifying Reissner-Nordstrom 3. The Kaluza-Klein metric 13. Petrov classification of metrics 4. The double divergence of R 14. Using a tetrad base 5. Helicity in hydrodynamics 15. The Friedmann equations 6. Magnetic field in plasma 16. Papapetrou's nonsymmetric metric 7. Spinor algebra 8. The EM field tensor 9. The Hodge star operator A. The Riemann and Weyl tensors B. The Rainich conditions C. The Einstein-Hilbert action D. Brans-Dicke cosmology X. Return to main menu Select an option by its number followed by a semicolon (;) 1; batching /home/vttoth/dev/maxima/share/tensor/bianchi.dem At the _ prompt, type ';' followed by enter to get next demo (%i1) if get('itensor, 'version) = false then load(itensor) (%o1) /home/vttoth/dev/maxima/share/tensor/itensor.lisp (%i2) The curvature tensor satisfies the cyclic identity: (%i3) icurvature([l, j, k], [i]) + icurvature([k, l, j], [i]) + icurvature([j, k, l], [i]) (%i4) ishow(%) i i %3 i i %3 (%t4) - ichr2 - ichr2 ichr2 + ichr2 + ichr2 ichr2 l k,j %3 j l k l j,k %3 k l j i i %2 i i %2 + ichr2 + ichr2 ichr2 - ichr2