]> www.ginac.de Git - ginac.git/commitdiff
used new diag_matrix() and matrix from lst constructor
authorChristian Bauer <Christian.Bauer@uni-mainz.de>
Fri, 23 Mar 2001 17:46:12 +0000 (17:46 +0000)
committerChristian Bauer <Christian.Bauer@uni-mainz.de>
Fri, 23 Mar 2001 17:46:12 +0000 (17:46 +0000)
check/exam_indexed.cpp

index e5a3772f5fc02a25dbccb21b99486209fffbdb3b..21e75405e80f92a06646f9abb68f05a612c1850f 100644 (file)
@@ -161,23 +161,15 @@ static unsigned edyn_check(void)
        L.set(0, 1, -beta*gamma);
        L.set(1, 0, -beta*gamma);
        L.set(1, 1, gamma);
-       L.set(2, 2, 1);
-       L.set(3, 3, 1);
+       L.set(2, 2, 1); L.set(3, 3, 1);
 
        // Electromagnetic field tensor
-       matrix F(4, 4);
-       F.set(0, 1, -Ex);
-       F.set(1, 0, Ex);
-       F.set(0, 2, -Ey);
-       F.set(2, 0, Ey);
-       F.set(0, 3, -Ez);
-       F.set(3, 0, Ez);
-       F.set(1, 2, -Bz);
-       F.set(2, 1, Bz);
-       F.set(1, 3, By);
-       F.set(3, 1, -By);
-       F.set(2, 3, -Bx);
-       F.set(3, 2, Bx);
+       matrix F(4, 4, lst(
+                0, -Ex, -Ey, -Ez,
+               Ex,   0, -Bz,  By,
+               Ey,  Bz,   0, -Bx,
+               Ez, -By,  Bx // 0
+       ));
 
        // Indices
        symbol s_mu("mu"), s_nu("nu"), s_rho("rho"), s_sigma("sigma");
@@ -185,8 +177,8 @@ static unsigned edyn_check(void)
 
        // Apply transformation law of second rank tensor
        ex e = (indexed(L, mu, rho.toggle_variance())
-          * indexed(L, nu, sigma.toggle_variance())
-          * indexed(F, rho, sigma)).simplify_indexed();
+             * indexed(L, nu, sigma.toggle_variance())
+             * indexed(F, rho, sigma)).simplify_indexed();
 
        // Extract transformed electric and magnetic fields
        ex Ex_p = e.subs(lst(mu == 1, nu == 0)).normal();
@@ -207,11 +199,7 @@ static unsigned edyn_check(void)
        // Test 2: check energy density and Poynting vector of electromagnetic field
 
        // Minkowski metric
-       matrix eta(4, 4);
-       eta.set(0, 0, 1);
-       eta.set(1, 1, -1);
-       eta.set(2, 2, -1);
-       eta.set(3, 3, -1);
+       ex eta = diag_matrix(lst(1, -1, -1, -1));
 
        // Covariant field tensor
        ex F_mu_nu = (indexed(eta, mu.toggle_variance(), rho.toggle_variance())