コード例 #1
0
        public static int Test_UnitVectorProduct_ToInt()
        {
            UnitVectorSpace uvs = new UnitVectorSpace(4); //Order four Unit Vector Space
            UnitVector      e1  = uvs["e1"];              //order 4 e1 unit operator

            e1.IsRowOrColumn = RowColumn.Row;

            UnitVector e2 = uvs["e2"]; // order 4 e2 unit vector
            int        dp = e1 * e2;   //product of Unit Vectors

            UnitVector e2prime = new UnitVector("e2", 4, RowColumn.Row);

            int dp2 = e2prime * e2;

            string latex = "e'_{1}e_{2} = " + dp.ToString() + @"\;,e'_{2}e_{2} = " + dp2.ToString();

            HtmlOutputMethods.WriteLatexEqToHtmlAndLaunch(latex, "Test_UnitVectorProduct_ToInt.html"); //display Latex via mathjax


            return(0);
        }
コード例 #2
0
        public static UnitVector operator*(UnitVector uv, ElementaryMatrix em)
        {
            UnitVector retVal = new UnitVector(0);

            retVal.Clear();
            if (uv.Order != em.Rows)
            {
                throw new Exception("Vector length must be same as number of columns and rows of matrix");
            }

            for (int rowCount = 0; rowCount < em.Rows; rowCount++)
            {
                int SumOfRow = 0;
                for (int colCount = 0; colCount < em.Columns; colCount++)
                {
                    SumOfRow += (em.InternalRep[rowCount, colCount] * uv[colCount]);
                }

                retVal.Add(SumOfRow);
            }

            return(retVal);
        }
コード例 #3
0
        public static int Test_UnitVector_Multiply_ElementaryMatrix()
        {
            /*
             * e'r * Eij = e'r * ei * e'j = &ri *e'j where & = Kronecker delta
             *
             */
            StringBuilder    sb  = new StringBuilder();
            ElementaryMatrix E12 = new ElementaryMatrix(4, 4, "E12");      // 4 x 4 ElementaryMatrix
            UnitVector       e1  = new UnitVector("e1", 4);                //Order four unit vector e1
            UnitVector       e2  = new UnitVector("e2", 4, RowColumn.Row); //Order four row unit vector e2
            UnitVector       er  = new UnitVector("e3", 4, RowColumn.Row); //Order four unit row vector e3 our er above

            /*
             * i = 1, j = 2, r = 3
             */

            sb.Append(@"e'_rE_{ij} = e'_re_ie'_j = \delta_{r j}e'j \\");
            //Test matrix unit vector * Elementary Matrix,  er * Eij
            UnitVector uvE1 = er * E12;

            sb.Append(@"e'_3E_{12} = " + uvE1.ToLatex() + @"\;");

            //Test e'r * ei * e'j
            UnitVector uvE2 = er * e1 * e2;

            sb.Append(@"e'_3e_1e'_2 = " + uvE2.ToLatex() + @"\;");

            //Test &ri * e'j
            UnitVector uvE3 = UnitVector.KroneckerDelta(3, 1) * e2;

            sb.Append(@" \delta_{3 1}e_2 = " + uvE3.ToLatex() + @" \tag{1}");

            HtmlOutputMethods.WriteLatexEqToHtmlAndLaunch(sb.ToString(), "Test_UnitVector_Multiply_ElementaryMatrix.html"); //display Latex via mathjax

            return(0);
        }
コード例 #4
0
        public static int Test_ElementaryMatrix_Multiply_UnitVector()
        {
            /*
             * Eij * er = ei*e'j*er = &jr *ei where & = Kronecker delta
             *
             */
            StringBuilder    sb  = new StringBuilder();
            ElementaryMatrix E12 = new ElementaryMatrix(4, 4, "E12");      // 4 x 4 ElementaryMatrix
            UnitVector       e1  = new UnitVector("e1", 4);                //Order four unit vector e1
            UnitVector       e2  = new UnitVector("e2", 4, RowColumn.Row); //Order four row unit vector e2
            UnitVector       er  = new UnitVector("e3", 4);                //Order four unit vector e3 our er above

            /*
             * i = 1, j = 2, r = 3
             */

            //Test matrix * unit vector, Eij * er
            UnitVector uvE1 = E12 * er;

            sb.Append(@"E_{12}e_3 = " + uvE1.ToLatex() + @"\;");

            //Test e1* e'j * er
            UnitVector uvE2 = e1 * e2 * er;

            sb.Append(@"e_1e'_2e_3 = " + uvE2.ToLatex() + @"\;");

            //Test &jr * ei
            UnitVector uvE3 = UnitVector.KroneckerDelta(2, 3) * e1;

            sb.Append(@" \delta_{2 3}e_1 = " + uvE3.ToLatex());

            HtmlOutputMethods.WriteLatexEqToHtmlAndLaunch(sb.ToString(), "Test_ElementaryMatrix_Multiply_UnitVector.html"); //display Latex via mathjax


            return(0);
        }