Exemple #1
0
        public void SchwarzchildSpacetime()
        {
            Variable t     = new Variable("t");
            Variable r     = new Variable("r");
            Variable theta = new Variable("theta");
            Variable phi   = new Variable("phi");
            Variable M     = new Variable("M");

            Vector4VariableU coordinates = new Vector4VariableU(t, r, theta, phi);
            Matrix4LL        metric      = new Matrix4LL(2 * M / r - 1, 1 / (1 - 2 * M / r), Functions.Pow(r, 2), Functions.Pow(r * Functions.Sin(theta), 2));
            Manifold4        manifold    = new Manifold4(metric, coordinates.Del);

            Spacetime spaceTime = new Spacetime(manifold);
            //Symbol comparison failure
            //Expected:<M*r^-3*(-(-2M*r^-1+1)^-1-(2M*r^-1-1)^-1) Actual: 0
            //Assert.AreEqual(spaceTime.EinsteinTensor, Matrix4UU.Zero);
            //Symbol comparison failure
            // Expected:<M*r^-3*(-(-2M*r^-1+1)^-1-(2M*r^-1-1)^-1) Actual: 0
            //Assert.AreEqual(spaceTime.EnergyMomentumTensor, Matrix4UU.Zero);
        }
        public void SchwarzschildManifold()
        {
            Variable t     = new Variable("t");
            Variable r     = new Variable("r");
            Variable theta = new Variable("theta");
            Variable phi   = new Variable("phi");
            Variable M     = new Variable("M");

            Vector4VariableU coordinates = new Vector4VariableU(t, r, theta, phi);
            Matrix4LL        metric      = new Matrix4LL(2 * M / r - 1, 1 / (1 - 2 * M / r), Functions.Pow(r, 2), Functions.Pow(r * Functions.Sin(theta), 2));
            Manifold4        manifold    = new Manifold4(metric, coordinates.Del);

            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(0, 0, 0));
            Assert.AreEqual(-1 / (2 * M / r - 1) * M * Functions.Pow(r, -2), manifold.ChristoffelSymbol(0, 0, 1));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(0, 0, 2));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(0, 0, 3));
            Assert.AreEqual(-1 / (2 * M / r - 1) * M * Functions.Pow(r, -2), manifold.ChristoffelSymbol(0, 1, 0));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(0, 1, 1));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(0, 1, 2));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(0, 1, 3));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(0, 2, 0));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(0, 2, 1));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(0, 2, 2));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(0, 2, 3));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(0, 3, 0));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(0, 3, 1));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(0, 3, 2));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(0, 3, 3));

            Assert.AreEqual((1 - 2 * M / r) * M / Functions.Pow(r, 2), manifold.ChristoffelSymbol(1, 0, 0));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(1, 0, 1));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(1, 0, 2));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(1, 0, 3));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(1, 1, 0));
            Assert.AreEqual(-1 / (1 - 2 * M / r) * M * Functions.Pow(r, -2), manifold.ChristoffelSymbol(1, 1, 1));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(1, 1, 2));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(1, 1, 3));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(1, 2, 0));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(1, 2, 1));
            //Symbol comparison failure
            //Expected:<(2M*r^-1-1)*r>. Actual:<-(-2M*r^-1+1)*r>
            //Assert.AreEqual(-(1 - 2 * M / r) * r, manifold.ChristoffelSymbol(1, 2, 2));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(1, 2, 3));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(1, 3, 0));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(1, 3, 1));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(1, 3, 2));
            //Symbol comparison failure
            //Expected:<(2M*r^-1-1)*r*sin(theta)^2>. Actual:<-(-2M*r^-1+1)*r*sin(theta)^2
            //Assert.AreEqual(-(1 - 2 * M / r) * r * Functions.Pow(Functions.Sin(theta), 2), manifold.ChristoffelSymbol(1, 3, 3));

            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(2, 0, 0));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(2, 0, 1));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(2, 0, 2));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(2, 0, 3));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(2, 1, 0));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(2, 1, 1));
            Assert.AreEqual(1 / r, manifold.ChristoffelSymbol(2, 1, 2));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(2, 1, 3));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(2, 2, 0));
            Assert.AreEqual(1 / r, manifold.ChristoffelSymbol(2, 2, 1));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(2, 2, 2));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(2, 2, 3));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(2, 3, 0));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(2, 3, 1));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(2, 3, 2));
            Assert.AreEqual(-Functions.Sin(theta) * Functions.Cos(theta), manifold.ChristoffelSymbol(2, 3, 3));

            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(3, 0, 0));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(3, 0, 1));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(3, 0, 2));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(3, 0, 3));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(3, 1, 0));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(3, 1, 1));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(3, 1, 2));
            Assert.AreEqual(1 / r, manifold.ChristoffelSymbol(3, 1, 3));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(3, 2, 0));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(3, 2, 1));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(3, 2, 2));
            Assert.AreEqual(Functions.Cos(theta) / Functions.Sin(theta), manifold.ChristoffelSymbol(3, 2, 3));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(3, 3, 0));
            Assert.AreEqual(1 / r, manifold.ChristoffelSymbol(3, 3, 1));
            Assert.AreEqual(Functions.Cos(theta) / Functions.Sin(theta), manifold.ChristoffelSymbol(3, 3, 2));
            Assert.AreEqual(Symbol.Zero, manifold.ChristoffelSymbol(3, 3, 3));
        }