Exemplo n.º 1
0
        public void SphericalManifold3()
        {
            Variable         r           = new Variable("r");
            Variable         theta       = new Variable("theta");
            Variable         phi         = new Variable("phi");
            Vector3VariableU coordinates = new Vector3VariableU(r, theta, phi);
            Matrix3LL        metric      = new Matrix3LL(Symbol.One, Functions.Pow(r, 2), Functions.Pow(r * Functions.Sin(theta), 2));
            Manifold3        manifold    = new Manifold3(metric, coordinates.Del);

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

                case 0x00000202:
                    return(-r *Functions.Pow(Functions.Sin(theta), 2));

                case 0x00010001:
                case 0x00020002:
                    return(1 / r);

                case 0x00010202:
                    return(-Functions.Sin(theta) * Functions.Cos(theta));

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

            ManifoldTests.TestManifold(manifold, christoffelSymbols, (i, j, k, l) => Symbol.Zero, (i, j) => Symbol.Zero, Symbol.Zero);
        }
Exemplo n.º 2
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));
        }
Exemplo n.º 3
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);
        }