File: relativity.cdb

package info (click to toggle)
cadabra2 2.4.3.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 78,796 kB
  • sloc: ansic: 133,450; cpp: 92,064; python: 1,530; javascript: 203; sh: 184; xml: 182; objc: 53; makefile: 51
file content (210 lines) | stat: -rw-r--r-- 5,740 bytes parent folder | download | duplicates (3)
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210

def test01():
    __cdbkernel__=create_scope()
    {m, n, p, q, r}::Indices(vector, position=fixed).
    {m, n, p, q, r}::Integer(0..9).
    g_{m n}::Metric.
    g^{m n}::InverseMetric.
    g_{m}^{n}::KroneckerDelta.
    g^{m}_{n}::KroneckerDelta.
    obj10:= g_{m p} g^{p m};
    eliminate_metric(_);
    eliminate_kronecker(_);
    tst10:= 10 - @(obj10);
    assert(tst10==0)
    print("Test 01 passed")

test01()

def test02():
    __cdbkernel__=create_scope()
    {m, n, p, q, r}::Indices(vector, position=fixed).
    g_{m n}::Metric.
    g^{m n}::InverseMetric.
    obj11b:= 3 g_{m p} g^{m p};
    eliminate_metric(_);
    tst11b:= 3 g_{p}^{p} - @(obj11b);
    assert(tst11b==0)
    print("Test 02 passed")

test02()

# Eliminating metrics in presence of derivatives.

def test03():
    __cdbkernel__=create_scope()
    {m, n, p, q, r}::Indices(vector, position=fixed).
    g_{m n}::Metric.
    \partial{#}::Derivative.
    obj12a:= g_{m n} \partial_{p}{ A^{n} };
    eliminate_metric(_);
    tst12a:= \partial_{p}{ A_{m} } - @(obj12a);
    assert(tst12a==0)
    print("Test 03 passed")
    
test03()

def test04():
    __cdbkernel__=create_scope()
    {m, n, p, q, r}::Indices(vector, position=fixed).
    g_{m n}::Metric.
    \partial{#}::Derivative.
    g_{m n}::Depends(\partial{#}).
    obj12b:= g_{m n} \partial_{p}{ A^{n} };
    eliminate_metric(_);
    tst12b:= g_{m n} \partial_{p}{ A^{n} } - @(obj12b);
    assert(tst12b==0)
    print("Test 04 passed")

test04()

# Reported bug with eliminate_metric.
# {a,b,c,d,e,i,j,k}::Indices(curved).
# g^{a b}::InverseMetric.
# \nabla{#}::Derivative.
# h_{a b}::Symmetric.
# ex:=g^{a k} * \nabla_{b}{h_{k c}} +g^{a k} * \nabla_{c}{h_{k b}};
# eliminate_metric(_);

def test05():
    __cdbkernel__=create_scope()
    { m, n, p }::Indices(flat, position=fixed).
    { \mu, \nu, \rho, \sigma, \kappa }::Indices(curved, position=fixed).
    obj:= H_{m n p} ( B^{m n p} + H^{m n p} );
    rewrite_indices(_, $H_{\mu\nu\rho}$, $e_{m}^{\mu}$);
    tst:= H_{\mu \nu \rho} * ( B^{m n p} + H^{m n p} ) * e_{m}^{\mu} * e_{n}^{\nu} * e_{p}^{\rho} - @(obj);
    assert(tst==0)
    print("Test 05 passed")

test05()

def test06():
    __cdbkernel__=create_scope()
    { m, n, p }::Indices(flat).
    { \mu, \nu, \rho, \mu# }::Indices(curved, position=fixed).
    obj:= H_{m n p} [ B^{m n p} + H^{m n p} ];
    rewrite_indices(_, $H_{\mu\nu\rho}$, $e_{m \mu}$);
    tst:= H_{m n p} [ B^{m n p} + H^{m n p} ] - @(obj);
    assert(tst==0)
    print("Test 06 passed")

test06()

def test08():
    __cdbkernel__=create_scope()
    { m,n,p,q,r,s,t,u }::Indices(curved, position=fixed).
    obj:= B_{m n p} B^{m n q} C_{q};
    rewrite_indices(_, $B_{m n p}$, $g^{m n}$);
    tst:= B_{m n p} B_{r s t} C_{q} g^{m r} g^{n s} g^{q t} - @(obj);
    assert(tst==0)
    print("Test 08 passed")

test08()

def test09():
    __cdbkernel__=create_scope()
    { m,n,p,q,r,s,t,u }::Indices(curved, position=free).
    obj:= B_{m n p} B_{m n q} C_{q};
    rewrite_indices(_, $B_{m n p}$, $g^{m n}$);
    tst:= B_{m n p} B_{m n q} C_{q} - @(obj);
    assert(tst==0)
    print("Test 09 passed")

test09()

def test10():
    __cdbkernel__=create_scope()
    {m,n,p,q,r,s}::Indices(curved, position=fixed).
    ex:=H_{m n p};
    rewrite_indices(_, $H^{m n p}$, $g_{m n}$);
    tst:=H^{q r s} g_{m q} g_{n r} g_{p s} - @(ex);
    assert(tst==0)
    print("Test 10 passed")

test10()

def test11():
    __cdbkernel__=create_scope()
    {a, b, c, d, e, f}::Indices(position=fixed).
    \eta_{a b}::Metric.
    ex:=F_{a}^{b} G_{b c} + F^{b d}G_{d a c b};
    rewrite_indices(_, $F_{a b}$, $\eta^{a b}$);
    tst:=F_{a d} G_{b c} \eta^{b d} + F_{e f} G_{d a c b} \eta^{b e} \eta^{d f} - @(ex);
    assert(tst==0)
    print("Test 11 passed")

test11()

def test12():
    __cdbkernel__=create_scope()  
    x::Coordinate.
    {a, b}::Indices(position=fixed).
    {a, b}::Integer(0..3).
    g_{a b}::Metric.
    g^{a b}::InverseMetric.
    g^{\mu?}_{\nu?}::KroneckerDelta.
    g_{\mu?}^{\nu?}::KroneckerDelta.
    \hat{#}::Accent.
    ex:=\hat{g^{a b}} \hat{g_{a b}};
    eliminate_metric(_);
    eliminate_kronecker(_);
    tst:= 4 - @(ex);
    assert(tst==0)
    print("Test 12 passed")

test12()

def test13():
    __cdbkernel__=create_scope()  
    { m, n, p }::Indices(flat).
    { \mu, \nu, \rho }::Indices(curved).
    e^{m}_{\mu}::Vielbein.
    ex:= H_{m n p} e^{m}_{\mu} e^{p}_{\rho};
    eliminate_vielbein(_, repeat=True);
    tst:= H_{\mu n \rho} - @(ex);
    assert(tst==0)
    print("Test 13 passed")

test13()

def test14():
    __cdbkernel__=create_scope()
    {a,b,c,d,e,f}::Indices(position=fixed);
    g_{a b}::Metric().
    g^{a b}::InverseMetric().
    A:=X_{a} g^{a b} g_{b c} g^{c d} g_{d e} g^{e f};
    eliminate_metric(_, repeat=True)
    tst:= X^{f} - @(A);
    assert(tst==0)
    print("Test 14a passed")
    A:=X_{a} g^{a b} g_{b c} g^{c d} g_{d e} g^{e f};
    eliminate_metric(_, repeat=True, redundant=True)
    tst:= X_{e} g^{e f} - @(A);
    assert(tst==0)
    print("Test 14b passed")

test14()
        
        
        
# { m, n, p }::Indices(flat).
# { \mu, \nu, \rho }::Indices(curved).
# e^{m}_{\mu}::Vielbein.
# e_{m}^{\mu}::InverseVielbein.
# ex:= e_{m}^{\mu} e^{m}_{\nu};
# eliminate_vielbein(_);

# def post_process(ex):
#     substitute(ex, $\delta^{0}_{\alpha} -> 0$)
#     return ex
#         
# {a,b,c,d,e}::Indices(fourD, position=independent);
# {a,b,c,d,e}::Integer(0..4);
# {\alpha,\beta,\gamma,\delta,\epsilon}::Indices(threeD, position=independent, parent=fourD);
# {\alpha,\beta,\gamma,\delta,\epsilon}::Integer(1..3);
# \delta{#}::KroneckerDelta();
# ex := \gamma^{\alpha \beta} \delta^{0}_{d} \delta^{d}_{\alpha};
# eliminate_kronecker(ex, repeat=False);