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
|
def test01():
__cdbkernel__=create_scope()
{i,j,k}::Indices;
{i,j,k}::Integer(1..3);
rl:= N_{i j} -> A_{i j};
ex:= N_{1 2};
substitute(ex, rl)
tst:= A_{1 2} - @(ex);
assert(tst==0)
print("Test 01 passed")
test01()
# A{#}::NumericalFlat.
# ex:= A{3}{B}{D};
#
# \bar{#}::DiracBar;
# ex:= \bar{4 \psi};
#
def test02():
__cdbkernel__=create_scope()
i::ImaginaryI;
ex:= i i A_{m n} i B^{m} i i C i D i ;
tst:= - A_{m n} B^{m} C D i - @(ex);
assert(tst==0)
print("Test 02 passed")
test02()
def test03():
__cdbkernel__=create_scope()
ex:= (2 r**2)**6;
tst:= 64 r**(12) - @(ex);
assert(tst==0)
print("Test 03a passed")
a::Integer;
ex:= (2 r**2)**a;
tst:= 2**a r**(2 a) - @(ex);
assert(tst==0)
print("Test 03b passed")
ex:= (2 r**2)**b;
tst:= (2 r**2)**b - @(ex);
assert(tst==0)
print("Test 03c passed")
ex:= (2 r)**6;
tst:= 64 r**6 - @(ex);
assert(tst==0)
print("Test 03d passed")
ex:= (2 (3 r)**2)**6;
tst:= 34012224 r**(12) - @(ex);
assert(tst==0)
print("Test 03e passed")
ex:= (2 r**2)**(-6);
tst:= 1/64 r**(-12) - @(ex);
assert(tst==0)
print("Test 03f passed")
test03()
def test04():
__cdbkernel__=create_scope()
\partial{#}::PartialDerivative;
t::Coordinate;
ex:= - 2\frac{\partial_{t}{a**2}**3}{a**3};
product_rule(_)
tst:= -16 (a \partial_{t}{a} )**3 a**(-3) - @(ex);
assert(tst==0)
print("Test 04 passed")
test04()
def test05():
__cdbkernel__=create_scope()
ex:= 2**3;
expand_power(_)
tst:= 8 - @(ex);
assert(tst==0)
print("Test 05 passed")
test05()
def test06():
__cdbkernel__=create_scope()
{t}::Coordinate;
ex := Q / (f**2 - Q**2);
substitute(ex, $ f = (Q**2 - \alpha )**(1/2) $)
tst:= - Q / \alpha - @(ex);
assert(tst==0)
print("Test 06 passed")
test06()
|