File: packages.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 (34 lines) | stat: -rw-r--r-- 988 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

import cdb.relativity.abstract as rel

def test01():
    __cdbkernel__=create_scope()
    \partial{#}::PartialDerivative;
    ex = rel.riemann_from_christoffel($Q$, $\gamma$)
    exl = lhs(ex)
    exr = rhs(ex)
    tstl := Q^{\rho}_{\sigma\mu\nu} - @(exl);
    assert(tstl==0)
    print("Test 01a passed")
    tstr := \partial_{\mu}{\gamma^{\rho}_{\nu\sigma}} -\partial_{\nu}{\gamma^{\rho}_{\mu\sigma}} + \gamma^{\rho}_{\mu\lambda} \gamma^{\lambda}_{\nu\sigma} - \gamma^{\rho}_{\nu\lambda} \gamma^{\lambda}_{\mu\sigma} - @(exr);
    assert(tstr==0)
    print("Test 01b passed")

test01()

def test02():
    __cdbkernel__=create_scope()
    import cdb.core.manip as manip
    {I,J}::Indices(position=fixed);
    \delta{#}::Derivative;
    ex:= A = B C;
    lhs= manip.get_lhs(ex)
    rhs= manip.get_rhs(ex)        
    ex2:= \delta_{I}{ @(lhs) } = \delta_{I}{ @(rhs) };
    tst:= (\delta_{I}{A} = \delta_{I}{B C}) - @(ex2);
    assert tst == $0=0$
    print("Test 02 passed")

test02()