return result;
}
+static unsigned epsilon_check(void)
+{
+ // checks identities of the epsilon tensor
+
+ unsigned result = 0;
+
+ symbol s_mu("mu"), s_nu("nu"), s_rho("rho"), s_sigma("sigma");
+ varidx mu(s_mu, 4), nu(s_nu, 4), rho(s_rho, 4), sigma(s_sigma, 4);
+
+ // antisymmetry
+ result += check_equal(lorentz_eps(mu, nu, rho, sigma) + lorentz_eps(sigma, rho, mu, nu), 0);
+
+ // convolution is zero
+ result += check_equal(lorentz_eps(mu, nu, rho, nu.toggle_variance()), 0);
+ result += check_equal(lorentz_eps(mu, nu, mu.toggle_variance(), nu.toggle_variance()), 0);
+ result += check_equal_simplify(lorentz_g(mu.toggle_variance(), nu.toggle_variance()) * lorentz_eps(mu, nu, rho, sigma), 0);
+
+ return result;
+}
+
static unsigned symmetry_check(void)
{
// check symmetric/antisymmetric objects
static unsigned edyn_check(void)
{
- // relativistic electrodynamics: check transformation laws of electric
- // and magnetic fields by applying a Lorentz boost to the field tensor
+ // Relativistic electrodynamics
+
+ // Test 1: check transformation laws of electric and magnetic fields by
+ // applying a Lorentz boost to the field tensor
unsigned result = 0;
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");
// 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();
result += check_equal(By_p, gamma * (By + beta * Ez));
result += check_equal(Bz_p, gamma * (Bz - beta * Ey));
+ // Test 2: check energy density and Poynting vector of electromagnetic field
+
+ // Minkowski metric
+ ex eta = diag_matrix(lst(1, -1, -1, -1));
+
+ // Covariant field tensor
+ ex F_mu_nu = (indexed(eta, mu.toggle_variance(), rho.toggle_variance())
+ * indexed(eta, nu.toggle_variance(), sigma.toggle_variance())
+ * indexed(F, rho, sigma)).simplify_indexed();
+
+ // Energy-momentum tensor
+ ex T = (-indexed(eta, rho, sigma) * F_mu_nu.subs(s_nu == s_rho)
+ * F_mu_nu.subs(lst(s_mu == s_nu, s_nu == s_sigma))
+ + indexed(eta, mu.toggle_variance(), nu.toggle_variance())
+ * F_mu_nu.subs(lst(s_mu == s_rho, s_nu == s_sigma))
+ * indexed(F, rho, sigma) / 4).simplify_indexed() / (4 * Pi);
+
+ // Extract energy density and Poynting vector
+ ex E = T.subs(lst(s_mu == 0, s_nu == 0)).normal();
+ ex Px = T.subs(lst(s_mu == 0, s_nu == 1));
+ ex Py = T.subs(lst(s_mu == 0, s_nu == 2));
+ ex Pz = T.subs(lst(s_mu == 0, s_nu == 3));
+
+ // Check results
+ result += check_equal(E, (Ex*Ex+Ey*Ey+Ez*Ez+Bx*Bx+By*By+Bz*Bz) / (8 * Pi));
+ result += check_equal(Px, (Ez*By-Ey*Bz) / (4 * Pi));
+ result += check_equal(Py, (Ex*Bz-Ez*Bx) / (4 * Pi));
+ result += check_equal(Pz, (Ey*Bx-Ex*By) / (4 * Pi));
+
return result;
}
result += delta_check(); cout << '.' << flush;
result += metric_check(); cout << '.' << flush;
+ result += epsilon_check(); cout << '.' << flush;
result += symmetry_check(); cout << '.' << flush;
result += edyn_check(); cout << '.' << flush;