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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
# Test 1:= Brackets with a sum and the same external index or indices.
#
# obj1:= (a+b)_\mu + (c+d)_\mu;
# @combine!(%);
# tst1:= (a+b+c+d)_\mu - @(obj1);
# @collect_terms!(%);
# @assert(tst1);
# Test 2: Brackets in a product, with summed outer indices.
#
@reset.
obj2:= (\Gamma_r)_{\alpha\beta} (\Gamma_{s t u})_{\beta\gamma};
@combine!(%);
tst2:= (\Gamma_r \Gamma_{s t u})_{\alpha\gamma} - @(obj2);
@collect_terms!(%);
@assert(tst2);
obj3:= (\Gamma_r)_{\alpha\beta} Q_\beta;
@combine!(%);
tst3:= (\Gamma_r Q)_{\alpha} - @(obj3);
@collect_terms!(%);
@assert(tst3);
# Expand
#
@reset.
{\alpha, \beta, \gamma, \delta}::Indices(spinor).
\Gamma{#}::GammaMatrix.
Q::ImplicitIndex.
obj4:= (\Gamma_r Q)_\alpha;
@expand!(%);
tst4:= (\Gamma_r)_{\alpha\beta} Q_{\beta} - @(obj4);
@collect_terms!(%);
@assert(tst4);
@reset.
A::Matrix.
B::ImplicitIndex.
{m,n,p}::Indices(vector).
obj5:= (A B)_{m};
@expand(%);
tst5:= A_{m n} B_{n} - @(obj5);
@collect_terms!(%);
@reset.
A::ImplicitIndex.
B::Matrix.
{m,n,p}::Indices(vector).
obj5:= (A B)_{m};
@expand(%);
tst5:= A_{n} B_{n m} - @(obj5);
@collect_terms!(%);
# FIXME: segfaults!
# @reset.
# B::Matrix.
# C::ImplicitIndex.
# {m,n#}::Indices(vector).
# obj6:= (A C D B)_{m};
# @expand(%);
# tst6:= A C_{n1} D B_{n1 m} - @(obj6);
# @collect_terms!(%);
@reset.
{A,B}::Matrix.
{m,n,p}::Indices(vector).
obj7:= (A B)_{m n};
@expand!(%);
tst7:= A_{m p} B_{p n} - @(obj7);
@collect_terms!(%);
@assert(tst7);
# Test 8: adding indexbrackets
#
@reset.
obj8:= (A_{m} + B_{m})_{c} + (C_{m}+D_{m})_{c};
tst8:= (A_{m} + B_{m})_{c} + (C_{m}+D_{m})_{c} - @(obj8);
@collect_terms!(%);
@assert(tst8);
|