Ejemplo n.º 1
0
        public void SpherePolarManifold2()
        {
            Variable         R           = new Variable("R");
            Variable         theta       = new Variable("theta");
            Variable         phi         = new Variable("phi");
            Vector2VariableU coordinates = new Vector2VariableU(theta, phi);
            Matrix2LL        metric      = new Matrix2LL(Functions.Pow(R, 2), Functions.Pow(R * Functions.Sin(theta), 2));
            Manifold2        manifold    = new Manifold2(metric, coordinates.Del);

            Func <int, int, int, Symbol> christoffelSymbols = (i, j, k) =>
            {
                switch ((i << 16) + (j << 8) + k)
                {
                case 0x00000101:
                    return(-Functions.Sin(theta) * Functions.Cos(theta));

                case 0x00010001:
                    return(Functions.Cos(theta) / Functions.Sin(theta));
                }
                return(Symbol.Zero);
            };

            Func <int, int, int, int, Symbol> riemannTensor = (i, j, k, l) =>
            {
                switch ((i << 24) + (j << 16) + (k << 8) + l)
                {
                case 0x00010001:
                    return(Functions.Pow(Functions.Sin(theta), 2));

                case 0x01000001:
                    return(-Symbol.One);
                }

                return(Symbol.Zero);
            };

            Func <int, int, Symbol> ricciTensor = (i, j) =>
            {
                switch ((i << 8) + j)
                {
                case 0x00000000:
                    return(Symbol.One);

                case 0x00000101:
                    return(Functions.Pow(Functions.Sin(theta), 2));
                }
                return(Symbol.Zero);
            };

            ManifoldTests.TestManifold(manifold, christoffelSymbols, riemannTensor, ricciTensor, 2 * Functions.Pow(R, -2));
        }
Ejemplo n.º 2
0
        public void PlanePolarManifold2()
        {
            Variable         r           = new Variable("r");
            Variable         theta       = new Variable("theta");
            Vector2VariableU coordinates = new Vector2VariableU(r, theta);
            Matrix2LL        metric      = new Matrix2LL(Symbol.One, Functions.Pow(r, 2));
            Manifold2        manifold    = new Manifold2(metric, coordinates.Del);

            Func <int, int, int, Symbol> christoffelSymbols = (i, j, k) => {
                switch ((i << 16) + (j << 8) + k)
                {
                case 0x00000101:
                    return(-r);

                case 0x00010001:
                    return(1 / r);
                }
                return(Symbol.Zero);
            };

            ManifoldTests.TestManifold(manifold, christoffelSymbols, (i, j, k, l) => Symbol.Zero, (i, j) => Symbol.Zero, Symbol.Zero);
        }