File: dummies.cdb

package info (click to toggle)
cadabra 1.46-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 5,244 kB
  • sloc: cpp: 33,188; ansic: 2,724; makefile: 329; yacc: 180; sh: 157; python: 45; lex: 38; lisp: 19
file content (80 lines) | stat: -rw-r--r-- 2,018 bytes parent folder | download | duplicates (5)
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
# 
#

\delta_{a b}::KroneckerDelta.
obj0:= \delta_{i1 i1};
{i1,i2}::Integer(0..9).
obj1:= @eliminate_kr[@(obj0)];
\Gamma_{?}::GammaMatrix.
obj1bb:= @distribute![ @join![ q \Gamma_{a b} \Gamma_{c} ] ];
#
# The following one fails: eliminate acts now, and then a crash occurs.
# DID NOT TEST WITH CDB_PARANOID ON!!!
#
#obj1b:= @eliminate_kr![q \delta_{i1 i1}];
#obj2:= @eliminate_kr![q*@(obj0)];
# obj1:= \delta_{i1 i1} @eliminate_kr![q*@(obj0)];
# tst1:= 10 q \delta_{i1 i1} - @(obj1);
# @prodsort!(%):
# @collect_terms!(%);
# @assert(tst1);
# 
# 
{a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,m,n,q,r,s,a,b}::Indices(vector).

# Relabelling inside a product.
#
fac:=  f_{m n}*g_{n q};
prod:= @(fac)*@(fac);
test1:= @(prod)-f_{m n}*g_{n q}*f_{m a1}*g_{a1 q};
@collect_terms!(%);
@assert(%);

# Relabelling inside a product occurring inside a sum.
#
obj:=   a_{m n} b^{n};
some:=  q_{n} foo^{n};
funky:= c_{m} + @(obj) @(some);
test2:= @(funky)-c_{m}-a_{m a1}*b^{a1}*q_{a2}*foo^{a2};
@rename_dummies!(%);
@collect_terms!(%);
@assert(%);

# Accepting zeroes in combination with anything.
#
obj3:=  F_{m n p} = 0;

# Some more that should run without producing errors.
#
f_{s} ( g_{r} + h_{r} ) ( q_{r} * s_{q} );
@indexlist(%);

{a1,a2,a3,a4,a5,a6,a7,a8,a9,a10}::Indices(vector).
fac2:=  f_{m r s}*(g_{s q}+p_{s q}*(tens^{a b}*tensb_{a b}))+h_{m n}*g_{n q r};
@indexlist(%);
prod2:= @(fac2)*@(fac2);

{a1,a2,a3,a4,a5,a6,a7,a8,a9,a10}::Indices(vector).
fac2:=  f_{m r s}*(g_{s}+p_{s}*(tens^{a b}*tensb_{a b}))+h_{m n}*g_{n r};
@indexlist(%);
prod2:= @(fac2)*@(fac2);

{a1,a2,a3,a4,a5,a6,a7,a8,a9,a10}::Indices(vector).
one:= a_{m n}+b_{m n};
two:= @(one)*@(one);
three:= @(two)*@(one);
four:=  @(one)*@(two);

# Test 5: range wildcard names.
#

@reset;
{ n#, m, n }::Indices(vector).
obj5:= A_{m n1} B_{n1 n};
obj5b:= @(obj5) * @(obj5);
obj5c:= @(obj5b) * @(obj5b);
@rename_dummies!(%);
tst5:= A_{n1 n2} * B_{n2 n3} * A_{n1 n4} * B_{n4 n3} * A_{n5 n6} * B_{n6 n7} * A_{n5 n8} * B_{n8 n7} - @(obj5c);
@collect_terms!(%);
@assert(tst5);